HAL FLASH Functions ¶
HAL FLASH Initialization and De-initialization functions ¶
- group FLASH_Exported_Functions_Group1
-
This subsection provides a set of functions allowing initialization and de-initialization of the FLASH peripheral:
Call the function HAL_FLASH_Init() to initialize the FLASH handle and associate a physical FLASH instance. (As optional, FLASH clock is enabled inside the function)
Call the function HAL_FLASH_DeInit() to de-initialize the FLASH handle.
Functions
-
hal_status_t
HAL_FLASH_Init
(
hal_flash_handle_t
*
hflash
,
hal_flash_t
instance
)
¶
-
Initialize the FLASH handle and associate a physical FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
instance – Specifies the FLASH instance based on hal_flash_t enumeration.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter when hflash pointer is NULL.
HAL_OK – FLASH is successfully initialized.
-
void
HAL_FLASH_DeInit
(
hal_flash_handle_t
*
hflash
)
¶
-
De-initialize the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- group FLASH_Exported_Functions_Group1
-
This subsection provides a set of functions allowing initialization and de-initialization of the FLASH peripheral:
Call the function HAL_FLASH_Init() to initialize the FLASH handle and associate a physical FLASH instance. (As optional, FLASH clock is enabled inside the function)
Call the function HAL_FLASH_DeInit() to de-initialize the FLASH handle.
Functions
-
hal_status_t
HAL_FLASH_Init
(
hal_flash_handle_t
*
hflash
,
hal_flash_t
instance
)
-
Initialize the FLASH handle and associate a physical FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
instance – Specifies the FLASH instance based on hal_flash_t enumeration.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter when hflash pointer is NULL.
HAL_OK – FLASH is successfully initialized.
-
void
HAL_FLASH_DeInit
(
hal_flash_handle_t
*
hflash
)
-
De-initialize the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- group FLASH_Exported_Functions_Group1
-
This subsection provides a set of functions allowing initialization and de-initialization of the FLASH peripheral:
Call the function HAL_FLASH_Init() to initialize the FLASH handle and associate a physical FLASH instance. (As optional, FLASH clock is enabled inside the function)
Call the function HAL_FLASH_DeInit() to de-initialize the FLASH handle.
Functions
-
hal_status_t
HAL_FLASH_Init
(
hal_flash_handle_t
*
hflash
,
hal_flash_t
instance
)
-
Initialize the FLASH handle and associate a physical FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
instance – Specifies the FLASH instance based on hal_flash_t enumeration.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter when hflash pointer is NULL.
HAL_OK – FLASH is successfully initialized.
-
void
HAL_FLASH_DeInit
(
hal_flash_handle_t
*
hflash
)
-
De-initialize the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
HAL FLASH Configuration functions ¶
- group FLASH_Exported_Functions_Group2
-
This subsection provides a set of functions allowing configuration of the FLASH peripheral:
Call the function HAL_FLASH_SetProgrammingMode() to set the programming mode according to selected parameter within hal_flash_program_mode_t enumeration.
Call the function HAL_FLASH_GetProgrammingMode() to get the current configured programming mode.
Functions
-
hal_status_t
HAL_FLASH_SetProgrammingMode
(
hal_flash_handle_t
*
hflash
,
hal_flash_program_mode_t
programming_mode
)
¶
-
Set the FLASH programming mode configuration.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
programming_mode – This parameter is one element of hal_flash_program_mode_t enumeration.
- Return values :
-
HAL_OK – Programming mode is successfully configured.
-
hal_flash_program_mode_t
HAL_FLASH_GetProgrammingMode
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Get the FLASH programming mode configuration.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
hal_flash_program_mode_t – Programming mode value.
- group FLASH_Exported_Functions_Group2
-
This subsection provides a set of functions allowing configuration of the FLASH peripheral:
Call the function HAL_FLASH_SetProgrammingMode() to set the programming mode according to selected parameter within hal_flash_program_mode_t enumeration.
Call the function HAL_FLASH_GetProgrammingMode() to get the current configured programming mode.
Functions
-
hal_status_t
HAL_FLASH_SetProgrammingMode
(
hal_flash_handle_t
*
hflash
,
hal_flash_program_mode_t
programming_mode
)
-
Set the FLASH programming mode configuration.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
programming_mode – This parameter is one element of hal_flash_program_mode_t enumeration.
- Return values :
-
HAL_OK – Programming mode is successfully configured.
-
hal_flash_program_mode_t
HAL_FLASH_GetProgrammingMode
(
const
hal_flash_handle_t
*
hflash
)
-
Get the FLASH programming mode configuration.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
hal_flash_program_mode_t – Programming mode value.
- group FLASH_Exported_Functions_Group2
-
This subsection provides a set of functions allowing configuration of the FLASH peripheral:
Call the function HAL_FLASH_SetProgrammingMode() to set the programming mode according to selected parameter within hal_flash_program_mode_t enumeration.
Call the function HAL_FLASH_GetProgrammingMode() to get the current configured programming mode.
Functions
-
hal_status_t
HAL_FLASH_SetProgrammingMode
(
hal_flash_handle_t
*
hflash
,
hal_flash_program_mode_t
programming_mode
)
-
Set the FLASH programming mode configuration.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
programming_mode – This parameter is one element of hal_flash_program_mode_t enumeration.
- Return values :
-
HAL_OK – Programming mode is successfully configured.
-
hal_flash_program_mode_t
HAL_FLASH_GetProgrammingMode
(
const
hal_flash_handle_t
*
hflash
)
-
Get the FLASH programming mode configuration.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
hal_flash_program_mode_t – Programming mode value.
HAL FLASH Process Operations functions ¶
- group FLASH_Exported_Functions_Group3
-
This subsection provides a set of functions allowing programming and erasing of the FLASH memory:
Call the function HAL_FLASH_ProgramByAddr() to program the FLASH USER memory by address in polling mode.
Call the function HAL_FLASH_ProgramByAddr_IT() to program the FLASH USER memory by address in interrupt mode.
Call the function HAL_FLASH_ProgramByAddrAdapt() to program the FLASH USER memory by address using adaptive width in polling mode.
Call the function HAL_FLASH_ProgramByAddrAdapt_IT() to program the FLASH USER memory by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_OTP_ProgramByAddr() to program the OTP area by address in polling mode.
Call the function HAL_FLASH_OTP_ProgramByAddr_IT() to program the OTP area by address in interrupt mode.
Call the function HAL_FLASH_OTP_ProgramByAddrAdapt() to program the OTP Area by address using adaptive width in polling mode.
Call the function HAL_FLASH_OTP_ProgramByAddrAdapt_IT() to program the OTP Area by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_EDATA_ProgramByAddr() to program the FLASH EDATA memory by address in polling mode.
Call the function HAL_FLASH_EDATA_ProgramByAddr_IT() to program the FLASH EDATA memory by address in interrupt mode.
Call the function HAL_FLASH_EDATA_ProgramByAddrAdapt() to program the FLASH EDATA memory by address using adaptive width in polling mode.
Call the function HAL_FLASH_EDATA_ProgramByAddrAdapt_IT() to program the FLASH EDATA memory by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_EraseByAddr() to erase the FLASH USER memory by address in polling mode.
Call the function HAL_FLASH_EraseByAddr_IT() to erase the FLASH USER memory by address in interrupt mode.
Call the function HAL_FLASH_EDATA_EraseByAddr() to erase the FLASH EDATA memory by address in polling mode.
Call the function HAL_FLASH_EDATA_EraseByAddr_IT() to erase the FLASH EDATA memory by address in interrupt mode.
Call the function HAL_FLASH_ErasePage() to erase the FLASH USER memory by page in polling mode.
Call the function HAL_FLASH_ErasePage_IT() to erase the FLASH USER memory by page in interrupt mode.
Call the function HAL_FLASH_EDATA_ErasePage() to erase the FLASH EDATA memory by page in polling mode.
Call the function HAL_FLASH_EDATA_ErasePage_IT() to erase the FLASH EDATA memory by page in interrupt mode.
Call the function HAL_FLASH_EraseBank() to erase the FLASH memory by bank in polling mode.
Call the function HAL_FLASH_EraseBank_IT() to erase the FLASH memory by bank in interrupt mode.
Call the function HAL_FLASH_MassErase() to mass erase the complete FLASH memoryin polling mode.
Call the function HAL_FLASH_MassErase_IT() to mass erase the complete FLASH memory in interrupt mode.
Call the function HAL_FLASH_IRQHandler() to handle any enabled interrupt and call its corresponding callback.
Call the function HAL_FLASH_ProgramByAddr_IRQHandler() to handle any enabled FLASH program interrupt and call its corresponding callback.
Call the function HAL_FLASH_EraseByAddr_IRQHandler() to handle any enabled FLASH erase by address interrupt and call its corresponding callback.
Call the function HAL_FLASH_ErasePage_IRQHandler() to handle any enabled FLASH erase page interrupt and call its corresponding callback.
Call the function HAL_FLASH_EraseBank_IRQHandler() to handle any enabled FLASH erase bank interrupt and call its corresponding callback.
Call the function HAL_FLASH_MassErase_IRQHandler() to handle any enabled FLASH mass erase interrupt and call its corresponding callback.
Call the function HAL_FLASH_ECC_IRQHandler() to handle any enabled interrupt and call its corresponding callback.
Call the function HAL_FLASH_NMI_IRQHandler() to handle any non-maskable interrupt and call its corresponding callback.
Functions
-
hal_status_t
HAL_FLASH_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Program the FLASH memory at specified user address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
¶
-
Program the FLASH memory at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Program the FLASH memory at specified user address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
¶
-
Program the FLASH memory at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Program the OTP area at specified address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
¶
-
Program the OTP area at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Program the OTP area at specified address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
¶
-
Program the OTP area at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Program the EDATA area at specified address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
¶
-
Program the EDATA area at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Program the EDATA area at specified address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
¶
-
Program the EDATA area at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Erase the FLASH memory at specified address in polling mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the area to be erased (in bytes). This parameter must be a multiple of the page size.
timeout_ms – Timeout value for erasing.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
¶
-
Erase the FLASH memory at specified address in interrupt mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the data to be erased (in bytes). This parameter must be a multiple of the page size.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_EraseByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
¶
-
Erase the FLASH EDATA memory at specified address in polling mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the area to be erased (in bytes). This parameter must be a multiple of the page size.
timeout_ms – Timeout value for erasing.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_EraseByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
¶
-
Erase the FLASH EDATA memory at specified address in interrupt mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the data to be erased (in bytes). This parameter must be a multiple of the page size.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_ErasePage
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
,
uint32_t
timeout_ms
)
¶
-
Erase the FLASH memory by page in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
timeout_ms – Timeout value for page erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_ErasePage_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
¶
-
Erase the FLASH memory by page in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ErasePage
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
,
uint32_t
timeout_ms
)
¶
-
Erase the FLASH EDATA memory by page in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
timeout_ms – Timeout value for page erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ErasePage_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
¶
-
Erase the FLASH EDATA memory by page in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseBank
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
timeout_ms
)
¶
-
Erase the FLASH memory by bank in polling mode.
Warning
This function will erase a specific Flash bank, thus it must not be mapped in this bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – Bank to be erased. This parameter can be one of the following values:
timeout_ms – Timeout value for bank erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseBank_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Erase the FLASH memory by bank in interrupt mode.
Warning
This function will erase a specific Flash bank, thus it must not be mapped in this bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – Bank to be erased. This parameter can be one of the following values:
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_MassErase
(
hal_flash_handle_t
*
hflash
,
uint32_t
timeout_ms
)
¶
-
Mass erase the FLASH memory in polling mode.
Warning
This function will erase the whole Flash, thus it must not be mapped in the Flash area.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
timeout_ms – Timeout value for mass erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_MassErase_IT
(
hal_flash_handle_t
*
hflash
)
¶
-
Mass erase the FLASH memory in interrupt mode.
Warning
This function will erase the whole Flash, thus it must not be mapped in the Flash area.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
void
HAL_FLASH_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ProgramByAddr_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH program by address interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_EraseByAddr_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH erase by address interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ErasePage_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH erase page interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_EraseBank_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH erase bank interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_MassErase_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH mass erase interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
hal_status_t
HAL_FLASH_NMI_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH ITF NMI interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
HAL_ERROR – Returned when the NMI has not been handled by this function.
HAL_OK – Returned when the NMI has been handled by this function.
-
void
HAL_FLASH_ECC_IRQHandler
(
hal_flash_handle_t
*
hflash
)
¶
-
Handle the FLASH ITF ECC correction interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- group FLASH_Exported_Functions_Group3
-
This subsection provides a set of functions allowing programming and erasing of the FLASH memory:
Call the function HAL_FLASH_ProgramByAddr() to program the FLASH USER memory by address in polling mode.
Call the function HAL_FLASH_ProgramByAddr_IT() to program the FLASH USER memory by address in interrupt mode.
Call the function HAL_FLASH_ProgramByAddrAdapt() to program the FLASH USER memory by address using adaptive width in polling mode.
Call the function HAL_FLASH_ProgramByAddrAdapt_IT() to program the FLASH USER memory by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_OTP_ProgramByAddr() to program the OTP area by address in polling mode.
Call the function HAL_FLASH_OTP_ProgramByAddr_IT() to program the OTP area by address in interrupt mode.
Call the function HAL_FLASH_OTP_ProgramByAddrAdapt() to program the OTP Area by address using adaptive width in polling mode.
Call the function HAL_FLASH_OTP_ProgramByAddrAdapt_IT() to program the OTP Area by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_EDATA_ProgramByAddr() to program the FLASH EDATA memory by address in polling mode.
Call the function HAL_FLASH_EDATA_ProgramByAddr_IT() to program the FLASH EDATA memory by address in interrupt mode.
Call the function HAL_FLASH_EDATA_ProgramByAddrAdapt() to program the FLASH EDATA memory by address using adaptive width in polling mode.
Call the function HAL_FLASH_EDATA_ProgramByAddrAdapt_IT() to program the FLASH EDATA memory by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_EraseByAddr() to erase the FLASH USER memory by address in polling mode.
Call the function HAL_FLASH_EraseByAddr_IT() to erase the FLASH USER memory by address in interrupt mode.
Call the function HAL_FLASH_EDATA_EraseByAddr() to erase the FLASH EDATA memory by address in polling mode.
Call the function HAL_FLASH_EDATA_EraseByAddr_IT() to erase the FLASH EDATA memory by address in interrupt mode.
Call the function HAL_FLASH_ErasePage() to erase the FLASH USER memory by page in polling mode.
Call the function HAL_FLASH_ErasePage_IT() to erase the FLASH USER memory by page in interrupt mode.
Call the function HAL_FLASH_EDATA_ErasePage() to erase the FLASH EDATA memory by page in polling mode.
Call the function HAL_FLASH_EDATA_ErasePage_IT() to erase the FLASH EDATA memory by page in interrupt mode.
Call the function HAL_FLASH_EraseBank() to erase the FLASH memory by bank in polling mode.
Call the function HAL_FLASH_EraseBank_IT() to erase the FLASH memory by bank in interrupt mode.
Call the function HAL_FLASH_MassErase() to mass erase the complete FLASH memoryin polling mode.
Call the function HAL_FLASH_MassErase_IT() to mass erase the complete FLASH memory in interrupt mode.
Call the function HAL_FLASH_IRQHandler() to handle any enabled interrupt and call its corresponding callback.
Call the function HAL_FLASH_ProgramByAddr_IRQHandler() to handle any enabled FLASH program interrupt and call its corresponding callback.
Call the function HAL_FLASH_EraseByAddr_IRQHandler() to handle any enabled FLASH erase by address interrupt and call its corresponding callback.
Call the function HAL_FLASH_ErasePage_IRQHandler() to handle any enabled FLASH erase page interrupt and call its corresponding callback.
Call the function HAL_FLASH_EraseBank_IRQHandler() to handle any enabled FLASH erase bank interrupt and call its corresponding callback.
Call the function HAL_FLASH_MassErase_IRQHandler() to handle any enabled FLASH mass erase interrupt and call its corresponding callback.
Call the function HAL_FLASH_ECC_IRQHandler() to handle any enabled interrupt and call its corresponding callback.
Call the function HAL_FLASH_NMI_IRQHandler() to handle any non-maskable interrupt and call its corresponding callback.
Functions
-
hal_status_t
HAL_FLASH_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the FLASH memory at specified user address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the FLASH memory at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the FLASH memory at specified user address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the FLASH memory at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the OTP area at specified address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the OTP area at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the OTP area at specified address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the OTP area at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the EDATA area at specified address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the EDATA area at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the EDATA area at specified address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the EDATA area at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Erase the FLASH memory at specified address in polling mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the area to be erased (in bytes). This parameter must be a multiple of the page size.
timeout_ms – Timeout value for erasing.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
Erase the FLASH memory at specified address in interrupt mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the data to be erased (in bytes). This parameter must be a multiple of the page size.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_EraseByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Erase the FLASH EDATA memory at specified address in polling mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the area to be erased (in bytes). This parameter must be a multiple of the page size.
timeout_ms – Timeout value for erasing.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_EraseByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
Erase the FLASH EDATA memory at specified address in interrupt mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the data to be erased (in bytes). This parameter must be a multiple of the page size.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_ErasePage
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
,
uint32_t
timeout_ms
)
-
Erase the FLASH memory by page in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
timeout_ms – Timeout value for page erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_ErasePage_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
-
Erase the FLASH memory by page in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ErasePage
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
,
uint32_t
timeout_ms
)
-
Erase the FLASH EDATA memory by page in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
timeout_ms – Timeout value for page erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ErasePage_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
-
Erase the FLASH EDATA memory by page in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseBank
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
timeout_ms
)
-
Erase the FLASH memory by bank in polling mode.
Warning
This function will erase a specific Flash bank, thus it must not be mapped in this bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – Bank to be erased. This parameter can be one of the following values:
timeout_ms – Timeout value for bank erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseBank_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Erase the FLASH memory by bank in interrupt mode.
Warning
This function will erase a specific Flash bank, thus it must not be mapped in this bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – Bank to be erased. This parameter can be one of the following values:
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_MassErase
(
hal_flash_handle_t
*
hflash
,
uint32_t
timeout_ms
)
-
Mass erase the FLASH memory in polling mode.
Warning
This function will erase the whole Flash, thus it must not be mapped in the Flash area.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
timeout_ms – Timeout value for mass erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_MassErase_IT
(
hal_flash_handle_t
*
hflash
)
-
Mass erase the FLASH memory in interrupt mode.
Warning
This function will erase the whole Flash, thus it must not be mapped in the Flash area.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
void
HAL_FLASH_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ProgramByAddr_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH program by address interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_EraseByAddr_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH erase by address interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ErasePage_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH erase page interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_EraseBank_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH erase bank interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_MassErase_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH mass erase interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
hal_status_t
HAL_FLASH_NMI_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH ITF NMI interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
HAL_ERROR – Returned when the NMI has not been handled by this function.
HAL_OK – Returned when the NMI has been handled by this function.
-
void
HAL_FLASH_ECC_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH ITF ECC correction interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- group FLASH_Exported_Functions_Group3
-
This subsection provides a set of functions allowing programming and erasing of the FLASH memory:
Call the function HAL_FLASH_ProgramByAddr() to program the FLASH USER memory by address in polling mode.
Call the function HAL_FLASH_ProgramByAddr_IT() to program the FLASH USER memory by address in interrupt mode.
Call the function HAL_FLASH_ProgramByAddrAdapt() to program the FLASH USER memory by address using adaptive width in polling mode.
Call the function HAL_FLASH_ProgramByAddrAdapt_IT() to program the FLASH USER memory by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_OTP_ProgramByAddr() to program the OTP area by address in polling mode.
Call the function HAL_FLASH_OTP_ProgramByAddr_IT() to program the OTP area by address in interrupt mode.
Call the function HAL_FLASH_OTP_ProgramByAddrAdapt() to program the OTP Area by address using adaptive width in polling mode.
Call the function HAL_FLASH_OTP_ProgramByAddrAdapt_IT() to program the OTP Area by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_EDATA_ProgramByAddr() to program the FLASH EDATA memory by address in polling mode.
Call the function HAL_FLASH_EDATA_ProgramByAddr_IT() to program the FLASH EDATA memory by address in interrupt mode.
Call the function HAL_FLASH_EDATA_ProgramByAddrAdapt() to program the FLASH EDATA memory by address using adaptive width in polling mode.
Call the function HAL_FLASH_EDATA_ProgramByAddrAdapt_IT() to program the FLASH EDATA memory by address using adaptive width in interrupt mode.
Call the function HAL_FLASH_EraseByAddr() to erase the FLASH USER memory by address in polling mode.
Call the function HAL_FLASH_EraseByAddr_IT() to erase the FLASH USER memory by address in interrupt mode.
Call the function HAL_FLASH_EDATA_EraseByAddr() to erase the FLASH EDATA memory by address in polling mode.
Call the function HAL_FLASH_EDATA_EraseByAddr_IT() to erase the FLASH EDATA memory by address in interrupt mode.
Call the function HAL_FLASH_ErasePage() to erase the FLASH USER memory by page in polling mode.
Call the function HAL_FLASH_ErasePage_IT() to erase the FLASH USER memory by page in interrupt mode.
Call the function HAL_FLASH_EDATA_ErasePage() to erase the FLASH EDATA memory by page in polling mode.
Call the function HAL_FLASH_EDATA_ErasePage_IT() to erase the FLASH EDATA memory by page in interrupt mode.
Call the function HAL_FLASH_EraseBank() to erase the FLASH memory by bank in polling mode.
Call the function HAL_FLASH_EraseBank_IT() to erase the FLASH memory by bank in interrupt mode.
Call the function HAL_FLASH_MassErase() to mass erase the complete FLASH memoryin polling mode.
Call the function HAL_FLASH_MassErase_IT() to mass erase the complete FLASH memory in interrupt mode.
Call the function HAL_FLASH_IRQHandler() to handle any enabled interrupt and call its corresponding callback.
Call the function HAL_FLASH_ProgramByAddr_IRQHandler() to handle any enabled FLASH program interrupt and call its corresponding callback.
Call the function HAL_FLASH_EraseByAddr_IRQHandler() to handle any enabled FLASH erase by address interrupt and call its corresponding callback.
Call the function HAL_FLASH_ErasePage_IRQHandler() to handle any enabled FLASH erase page interrupt and call its corresponding callback.
Call the function HAL_FLASH_EraseBank_IRQHandler() to handle any enabled FLASH erase bank interrupt and call its corresponding callback.
Call the function HAL_FLASH_MassErase_IRQHandler() to handle any enabled FLASH mass erase interrupt and call its corresponding callback.
Call the function HAL_FLASH_ECC_IRQHandler() to handle any enabled interrupt and call its corresponding callback.
Call the function HAL_FLASH_NMI_IRQHandler() to handle any non-maskable interrupt and call its corresponding callback.
Functions
-
hal_status_t
HAL_FLASH_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the FLASH memory at specified user address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the FLASH memory at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the FLASH memory at specified user address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the FLASH memory at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash to be programmed.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the OTP area at specified address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the OTP area at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the OTP area at specified address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_OTP_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
otp_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the OTP area at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
otp_addr – OTP address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked or when the TrustZone enabled.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the EDATA area at specified address in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the EDATA area at specified address in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddrAdapt
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Program the EDATA area at specified address using adaptive width in polling mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
timeout_ms – Timeout value for programming.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ProgramByAddrAdapt_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
const
uint32_t
*
p_data
,
uint32_t
size_byte
)
-
Program the EDATA area at specified address using adaptive width in interrupt mode.
Note
The adaptive mode optimizes FLASH programming access based on the remaining data size, ignoring the programming mode selected by the HAL_FLASH_SetProgrammingMode() API.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – FLASH EDATA address.
p_data – Pointer to the data to be programmed.
size_byte – Size of the data to be programmed (in bytes).
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new programming operation.
HAL_OK – Returned when the programming operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Erase the FLASH memory at specified address in polling mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the area to be erased (in bytes). This parameter must be a multiple of the page size.
timeout_ms – Timeout value for erasing.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
Erase the FLASH memory at specified address in interrupt mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the data to be erased (in bytes). This parameter must be a multiple of the page size.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_EraseByAddr
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
,
uint32_t
timeout_ms
)
-
Erase the FLASH EDATA memory at specified address in polling mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the area to be erased (in bytes). This parameter must be a multiple of the page size.
timeout_ms – Timeout value for erasing.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_EraseByAddr_IT
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
Erase the FLASH EDATA memory at specified address in interrupt mode.
Warning
Since the smallest erase granularity is at page level, this function will erase a greater area than the one defined by flash_addr and size_byte if these parameters do not represent an area aligned with the start and the end of flash pages.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Start address of flash page to be erased. This parameter must be aligned with the start of a page.
size_byte – Size of the data to be erased (in bytes). This parameter must be a multiple of the page size.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_ErasePage
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
,
uint32_t
timeout_ms
)
-
Erase the FLASH memory by page in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
timeout_ms – Timeout value for page erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_ErasePage_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
-
Erase the FLASH memory by page in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ErasePage
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
,
uint32_t
timeout_ms
)
-
Erase the FLASH EDATA memory by page in polling mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
timeout_ms – Timeout value for page erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EDATA_ErasePage_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
-
Erase the FLASH EDATA memory by page in interrupt mode.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – First page to be erased.
page_nbr – Number of pages to be erased.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseBank
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
timeout_ms
)
-
Erase the FLASH memory by bank in polling mode.
Warning
This function will erase a specific Flash bank, thus it must not be mapped in this bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – Bank to be erased. This parameter can be one of the following values:
timeout_ms – Timeout value for bank erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_EraseBank_IT
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Erase the FLASH memory by bank in interrupt mode.
Warning
This function will erase a specific Flash bank, thus it must not be mapped in this bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – Bank to be erased. This parameter can be one of the following values:
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_MassErase
(
hal_flash_handle_t
*
hflash
,
uint32_t
timeout_ms
)
-
Mass erase the FLASH memory in polling mode.
Warning
This function will erase the whole Flash, thus it must not be mapped in the Flash area.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
timeout_ms – Timeout value for mass erasing.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_TIMEOUT – Internal processing exceeded the timeout.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
hal_status_t
HAL_FLASH_MassErase_IT
(
hal_flash_handle_t
*
hflash
)
-
Mass erase the FLASH memory in interrupt mode.
Warning
This function will erase the whole Flash, thus it must not be mapped in the Flash area.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
HAL_ERROR – Returned when the FLASH access registers locked.
HAL_BUSY – Returned when the FLASH is busy and cannot start a new erase operation.
HAL_OK – Returned when the erasing operation completes successfully.
-
void
HAL_FLASH_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ProgramByAddr_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH program by address interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_EraseByAddr_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH erase by address interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ErasePage_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH erase page interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_EraseBank_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH erase bank interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_MassErase_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH mass erase interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
hal_status_t
HAL_FLASH_NMI_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH ITF NMI interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
HAL_ERROR – Returned when the NMI has not been handled by this function.
HAL_OK – Returned when the NMI has been handled by this function.
-
void
HAL_FLASH_ECC_IRQHandler
(
hal_flash_handle_t
*
hflash
)
-
Handle the FLASH ITF ECC correction interrupt request.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
HAL FLASH Callback functions ¶
- group FLASH_Exported_Functions_Group4
-
This subsection provides a set of functions allowing management of the FLASH callbacks:
The weak function HAL_FLASH_ProgramCpltCallback() can be redefined within user application for the program complete callback.
The weak function HAL_FLASH_EraseByAddrCpltCallback() can be redefined within user application for the erase by address complete callback.
The weak function HAL_FLASH_ErasePageCpltCallback() can be redefined within user application for the erase by page complete callback.
The weak function HAL_FLASH_EraseBankCpltCallback() can be redefined within user application for the bank erase complete callback.
The weak function HAL_FLASH_MassEraseCpltCallback() can be redefined within user application for the mass erase complete callback.
The weak function HAL_FLASH_ErrorCallback() can be redefined within user application for the error callback.
The weak function HAL_FLASH_ECC_ErrorCallback() can be redefined within user application for the ECC error callback.
Call the function HAL_FLASH_RegisterProgramCpltCallback() to register the FLASH program complete callback.
Call the function HAL_FLASH_RegisterEraseByAddrCpltCallback() to register the FLASH erase by address complete callback.
Call the function HAL_FLASH_RegisterErasePageCpltCallback() to register the FLASH erase by page complete callback.
Call the function HAL_FLASH_RegisterEraseBankCpltCallback() to register the FLASH bank erase complete callback.
Call the function HAL_FLASH_RegisterMassEraseCpltCallback() to register the FLASH as erase complete callback.
Call the function HAL_FLASH_RegisterErrorCallback() to register the FLASH error callback.
Call the function HAL_FLASH_RegisterECCErrorCallback() to register the FLASH ECC error callback.
Functions
-
void
HAL_FLASH_ProgramCpltCallback
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
¶
-
FLASH program complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Programmed address.
size_byte – Programmed size in byte.
-
void
HAL_FLASH_EraseByAddrCpltCallback
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
¶
-
FLASH erase by address complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Erased address.
size_byte – Erased size in byte.
-
void
HAL_FLASH_ErasePageCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
¶
-
FLASH erase by page complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Index of erased page.
page_nbr – Number of erased pages.
-
void
HAL_FLASH_EraseBankCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
FLASH bank erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
-
void
HAL_FLASH_MassEraseCpltCallback
(
hal_flash_handle_t
*
hflash
)
¶
-
FLASH mass erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
FLASH error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one element of the hal_flash_bank_t enumeration.
-
hal_status_t
HAL_FLASH_ECC_ErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
FLASH error code correction callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
HAL_ERROR – Returned when this callback did not manage the ECC interrupt.
HAL_OK – Returned when this callback managed the ECC interrupt.
-
hal_status_t
HAL_FLASH_RegisterProgramCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_program_cplt_cb_t
callback
)
¶
-
Register the FLASH program complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the program complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterEraseByAddrCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_by_addr_cplt_cb_t
callback
)
¶
-
Register the FLASH erase by address complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the erase by address complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterErasePageCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_page_cplt_cb_t
callback
)
¶
-
Register the FLASH erase by page complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the erase by page complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterEraseBankCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_bank_cplt_cb_t
callback
)
¶
-
Register the FLASH bank erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the bank erase complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterMassEraseCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_mass_erase_cplt_cb_t
callback
)
¶
-
Register the FLASH mass erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the mass erase complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_error_cb_t
callback
)
¶
-
Register the FLASH error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the error callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterECCErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_ecc_error_cb_t
callback
)
¶
-
Register the FLASH ECC error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the error callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
- group FLASH_Exported_Functions_Group4
-
This subsection provides a set of functions allowing management of the FLASH callbacks:
The weak function HAL_FLASH_ProgramCpltCallback() can be redefined within user application for the program complete callback.
The weak function HAL_FLASH_EraseByAddrCpltCallback() can be redefined within user application for the erase by address complete callback.
The weak function HAL_FLASH_ErasePageCpltCallback() can be redefined within user application for the erase by page complete callback.
The weak function HAL_FLASH_EraseBankCpltCallback() can be redefined within user application for the bank erase complete callback.
The weak function HAL_FLASH_MassEraseCpltCallback() can be redefined within user application for the mass erase complete callback.
The weak function HAL_FLASH_ErrorCallback() can be redefined within user application for the error callback.
The weak function HAL_FLASH_ECC_ErrorCallback() can be redefined within user application for the ECC error callback.
Call the function HAL_FLASH_RegisterProgramCpltCallback() to register the FLASH program complete callback.
Call the function HAL_FLASH_RegisterEraseByAddrCpltCallback() to register the FLASH erase by address complete callback.
Call the function HAL_FLASH_RegisterErasePageCpltCallback() to register the FLASH erase by page complete callback.
Call the function HAL_FLASH_RegisterEraseBankCpltCallback() to register the FLASH bank erase complete callback.
Call the function HAL_FLASH_RegisterMassEraseCpltCallback() to register the FLASH as erase complete callback.
Call the function HAL_FLASH_RegisterErrorCallback() to register the FLASH error callback.
Call the function HAL_FLASH_RegisterECCErrorCallback() to register the FLASH ECC error callback.
Functions
-
void
HAL_FLASH_ProgramCpltCallback
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
FLASH program complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Programmed address.
size_byte – Programmed size in byte.
-
void
HAL_FLASH_EraseByAddrCpltCallback
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
FLASH erase by address complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Erased address.
size_byte – Erased size in byte.
-
void
HAL_FLASH_ErasePageCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
-
FLASH erase by page complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Index of erased page.
page_nbr – Number of erased pages.
-
void
HAL_FLASH_EraseBankCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
FLASH bank erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
-
void
HAL_FLASH_MassEraseCpltCallback
(
hal_flash_handle_t
*
hflash
)
-
FLASH mass erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
FLASH error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one element of the hal_flash_bank_t enumeration.
-
hal_status_t
HAL_FLASH_ECC_ErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
FLASH error code correction callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
HAL_ERROR – Returned when this callback did not manage the ECC interrupt.
HAL_OK – Returned when this callback managed the ECC interrupt.
-
hal_status_t
HAL_FLASH_RegisterProgramCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_program_cplt_cb_t
callback
)
-
Register the FLASH program complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the program complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterEraseByAddrCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_by_addr_cplt_cb_t
callback
)
-
Register the FLASH erase by address complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the erase by address complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterErasePageCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_page_cplt_cb_t
callback
)
-
Register the FLASH erase by page complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the erase by page complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterEraseBankCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_bank_cplt_cb_t
callback
)
-
Register the FLASH bank erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the bank erase complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterMassEraseCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_mass_erase_cplt_cb_t
callback
)
-
Register the FLASH mass erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the mass erase complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_error_cb_t
callback
)
-
Register the FLASH error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the error callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterECCErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_ecc_error_cb_t
callback
)
-
Register the FLASH ECC error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the error callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
- group FLASH_Exported_Functions_Group4
-
This subsection provides a set of functions allowing management of the FLASH callbacks:
The weak function HAL_FLASH_ProgramCpltCallback() can be redefined within user application for the program complete callback.
The weak function HAL_FLASH_EraseByAddrCpltCallback() can be redefined within user application for the erase by address complete callback.
The weak function HAL_FLASH_ErasePageCpltCallback() can be redefined within user application for the erase by page complete callback.
The weak function HAL_FLASH_EraseBankCpltCallback() can be redefined within user application for the bank erase complete callback.
The weak function HAL_FLASH_MassEraseCpltCallback() can be redefined within user application for the mass erase complete callback.
The weak function HAL_FLASH_ErrorCallback() can be redefined within user application for the error callback.
The weak function HAL_FLASH_ECC_ErrorCallback() can be redefined within user application for the ECC error callback.
Call the function HAL_FLASH_RegisterProgramCpltCallback() to register the FLASH program complete callback.
Call the function HAL_FLASH_RegisterEraseByAddrCpltCallback() to register the FLASH erase by address complete callback.
Call the function HAL_FLASH_RegisterErasePageCpltCallback() to register the FLASH erase by page complete callback.
Call the function HAL_FLASH_RegisterEraseBankCpltCallback() to register the FLASH bank erase complete callback.
Call the function HAL_FLASH_RegisterMassEraseCpltCallback() to register the FLASH as erase complete callback.
Call the function HAL_FLASH_RegisterErrorCallback() to register the FLASH error callback.
Call the function HAL_FLASH_RegisterECCErrorCallback() to register the FLASH ECC error callback.
Functions
-
void
HAL_FLASH_ProgramCpltCallback
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
FLASH program complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Programmed address.
size_byte – Programmed size in byte.
-
void
HAL_FLASH_EraseByAddrCpltCallback
(
hal_flash_handle_t
*
hflash
,
uint32_t
flash_addr
,
uint32_t
size_byte
)
-
FLASH erase by address complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
flash_addr – Erased address.
size_byte – Erased size in byte.
-
void
HAL_FLASH_ErasePageCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
,
uint32_t
page_nbr
)
-
FLASH erase by page complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Index of erased page.
page_nbr – Number of erased pages.
-
void
HAL_FLASH_EraseBankCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
FLASH bank erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
-
void
HAL_FLASH_MassEraseCpltCallback
(
hal_flash_handle_t
*
hflash
)
-
FLASH mass erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
-
void
HAL_FLASH_ErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
FLASH error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one element of the hal_flash_bank_t enumeration.
-
hal_status_t
HAL_FLASH_ECC_ErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
FLASH error code correction callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
HAL_ERROR – Returned when this callback did not manage the ECC interrupt.
HAL_OK – Returned when this callback managed the ECC interrupt.
-
hal_status_t
HAL_FLASH_RegisterProgramCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_program_cplt_cb_t
callback
)
-
Register the FLASH program complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the program complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterEraseByAddrCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_by_addr_cplt_cb_t
callback
)
-
Register the FLASH erase by address complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the erase by address complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterErasePageCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_page_cplt_cb_t
callback
)
-
Register the FLASH erase by page complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the erase by page complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterEraseBankCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_erase_bank_cplt_cb_t
callback
)
-
Register the FLASH bank erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the bank erase complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterMassEraseCpltCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_mass_erase_cplt_cb_t
callback
)
-
Register the FLASH mass erase complete callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the mass erase complete callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_error_cb_t
callback
)
-
Register the FLASH error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the error callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
-
hal_status_t
HAL_FLASH_RegisterECCErrorCallback
(
hal_flash_handle_t
*
hflash
,
hal_flash_ecc_error_cb_t
callback
)
-
Register the FLASH ECC error callback.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
callback – Specifies the error callback.
- Return values :
-
HAL_INVALID_PARAM – Returned when an invalid input parameter selected.
HAL_OK – Returned when the register of the callback completes successfully.
HAL FLASH Status functions ¶
- group FLASH_Exported_Functions_Group5
-
This subsection provides a set of functions allowing access to FLASH data information and status:
Call the function HAL_FLASH_GetCurrentOperation() to get the current flash operation.
Call the function HAL_FLASH_GetCurrentProgrammedAddr() to get the currently being programmed flash address.
Call the function HAL_FLASH_GetCurrentErasedAddr() to get the currently being erased flash address.
Call the function HAL_FLASH_GetCurrentErasedPage() to get the currently being erased flash page.
Call the function HAL_FLASH_GetInterruptedByResetOperationInfo() to get the FLASH interrupted operation information.
Call the function HAL_FLASH_GetInfo() to get the FLASH information.
Call the function HAL_FLASH_GetSizeByte() to get the FLASH total size.
Call the function HAL_FLASH_GetBankNbr() to get the FLASH number of banks.
Call the function HAL_FLASH_GetBankSizeByte() to get the FLASH bank size.
Call the function HAL_FLASH_GetUserFlashSizeByte() to get the FLASH USER area size within a bank.
Call the function HAL_FLASH_EDATA_GetSizeByte() to get the FLASH EDATA area size within a bank
Call the function HAL_FLASH_GetExtUserFlashSizeByte() to get the FLASH Extended USER area size within a bank.
Call the function HAL_FLASH_GetUserFlashPageNbr() to get the number of pages in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetPageNbr() to get the number of pages in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashPageNbr() to get the number of pages in FLASH extended USER area.
Call the function HAL_FLASH_GetUserFlashPageSizeByte() to get the FLASH size of a given page in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetPageSizeByte() to get the FLASH size of a given page in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashPageSizeByte() to get the FLASH size of a given page in FLASH extended USER area.
Call the function HAL_FLASH_GetUserFlashAddrOffset() to get the address offset of a specific page in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetAddrOffset() to get the address offset of a specific page in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashAddrOffset() to get the address offset of a specific page in FLASH extended USER area. The offset is computed from the beginning of the FLASH extended USER area.
Call the function HAL_FLASH_ECC_GetInfo() to get the FLASH ECC information.
Call the function HAL_FLASH_GetInstance() to get the HAL FLASH instance.
Call the function HAL_FLASH_GetLLInstance() to get the hardware FLASH instance.
Call the function HAL_FLASH_GetState() to get the FLASH current state.
Call the function HAL_FLASH_GetLastErrorCodes() to get the FLASH last errors codes.
Call the function HAL_FLASH_SetUserData() to set a user data in the FLASH handle.
Call the function HAL_FLASH_GetUserData() to get a user data from the FLASH handle.
Functions
-
hal_flash_operation_t
HAL_FLASH_GetCurrentOperation
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the current operation on the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
hal_flash_operation_t – Operation ongoing.
-
uint32_t
HAL_FLASH_GetCurrentProgrammedAddr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the last programming operation information.
Note
This function must be called during or directly after a ProgramByAddr operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – FLASH address currently being programmed. 0xFFFFFFFF if no program by address operation is ongoing on the given bank.
-
uint32_t
HAL_FLASH_GetCurrentErasedAddr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the last address erase operation information.
Note
This function must be called during or directly after a EraseByAddr operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – Address of the FLASH page currently being erased. 0xFFFFFFFF if no erase page by address operation is ongoing on the given bank.
-
uint32_t
HAL_FLASH_GetCurrentErasedPage
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the last page erase operation information.
Note
This function must be called during or directly after an ErasePage operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – FLASH page currently being erased. 0xFFFFFFFF if no erase page operation is ongoing on the given bank.
-
void
HAL_FLASH_GetInterruptedByResetOperationInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_interrupted_by_reset_operation_info_t
*
p_info
)
¶
-
Get the interrupted operation information.
Warning
Be aware that if the interrupted operation is either in the EDATA (with EDATA_EN set to 1) or OTP areas, the reported address is not always accurate due to a hardware limitation. Indeed, in this case, the correct address can be one of the following:
Reported address + 0x400
Reported address + 0x200
Reported address
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_info – Pointer to a hal_flash_interrupted_by_reset_operation_info_t structure.
-
void
HAL_FLASH_GetInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_info_t
*
p_info
)
¶
-
Get the user FLASH info (size, number and size of banks, number and size of pages).
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_info – Pointer to a hal_flash_info_t structure.
-
uint32_t
HAL_FLASH_GetSizeByte
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Get the total FLASH size.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – size in bytes of total FLASH.
-
uint8_t
HAL_FLASH_GetBankNbr
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Get the number of FLASH banks.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – number of bank.
-
uint32_t
HAL_FLASH_GetBankSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the total size in bytes of the given FLASH bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – total size in bytes of the given bank.
-
uint32_t
HAL_FLASH_GetUserFlashSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the size in bytes of the user flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – size in bytes of the user flash area of the given bank.
-
uint32_t
HAL_FLASH_EDATA_GetSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the size in bytes of the EDATA flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – size in bytes of the EDATA flash area of the given bank.
-
uint16_t
HAL_FLASH_GetUserFlashPageNbr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the number of pages of the user flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – number of pages of the user flash area of the given bank.
-
uint16_t
HAL_FLASH_EDATA_GetPageNbr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
¶
-
Get the number of pages of the EDATA flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – number of pages of the EDATA flash area of the given bank.
-
uint32_t
HAL_FLASH_GetUserFlashPageSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
¶
-
Get the size in bytes of the given user area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Selected page.
- Return values :
-
The – size in bytes of the given user area page.
-
uint32_t
HAL_FLASH_EDATA_GetPageSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
¶
-
Get the size in bytes of the given EDATA area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Selected page.
- Return values :
-
The – size in bytes of the given EDATA area page.
-
uint32_t
HAL_FLASH_GetUserFlashAddrOffset
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
¶
-
Get the offset address of the given user area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Page within selected bank.
- Return values :
-
Address – The offset address of the given user area page.
-
uint32_t
HAL_FLASH_EDATA_GetAddrOffset
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
¶
-
Get the offset address of the given EDATA area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Page within selected bank.
- Return values :
-
Address – The offset address of the given EDATA area page.
-
void
HAL_FLASH_ECC_GetInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
hal_flash_ecc_info_t
*
p_info
)
¶
-
Get the ECC information.
Warning
Be aware that if the error is a ECC single error located either in the EDATA (with EDATA_EN set to 1) or OTP areas, the reported address is not always accurate due to a hardware limitation. Indeed, in this case, the correct address can be one of the following:
Reported address + 0x400
Reported address + 0x200
Reported address
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
p_info – Pointer to a hal_flash_ecc_info_t structure.
-
hal_flash_t
HAL_FLASH_GetInstance
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Get the HAL FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – HAL FLASH instance.
-
FLASH_TypeDef
*
HAL_FLASH_GetLLInstance
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Get the hardware FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – hardware FLASH instance.
-
hal_flash_state_t
HAL_FLASH_GetState
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Get the FLASH current state.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
State – The FLASH global state.
-
uint32_t
HAL_FLASH_GetLastErrorCodes
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Get the FLASH last error codes.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
Error – codes The FLASH last error codes.
-
void
HAL_FLASH_SetUserData
(
hal_flash_handle_t
*
hflash
,
const
void
*
p_user_data
)
¶
-
Store User Data pointer within the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_FLASH_GetUserData
(
const
hal_flash_handle_t
*
hflash
)
¶
-
Retrieve the user data pointer from the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
Pointer – to the user data.
- group FLASH_Exported_Functions_Group5
-
This subsection provides a set of functions allowing access to FLASH data information and status:
Call the function HAL_FLASH_GetCurrentOperation() to get the current flash operation.
Call the function HAL_FLASH_GetCurrentProgrammedAddr() to get the currently being programmed flash address.
Call the function HAL_FLASH_GetCurrentErasedAddr() to get the currently being erased flash address.
Call the function HAL_FLASH_GetCurrentErasedPage() to get the currently being erased flash page.
Call the function HAL_FLASH_GetInterruptedByResetOperationInfo() to get the FLASH interrupted operation information.
Call the function HAL_FLASH_GetInfo() to get the FLASH information.
Call the function HAL_FLASH_GetSizeByte() to get the FLASH total size.
Call the function HAL_FLASH_GetBankNbr() to get the FLASH number of banks.
Call the function HAL_FLASH_GetBankSizeByte() to get the FLASH bank size.
Call the function HAL_FLASH_GetUserFlashSizeByte() to get the FLASH USER area size within a bank.
Call the function HAL_FLASH_EDATA_GetSizeByte() to get the FLASH EDATA area size within a bank
Call the function HAL_FLASH_GetExtUserFlashSizeByte() to get the FLASH Extended USER area size within a bank.
Call the function HAL_FLASH_GetUserFlashPageNbr() to get the number of pages in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetPageNbr() to get the number of pages in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashPageNbr() to get the number of pages in FLASH extended USER area.
Call the function HAL_FLASH_GetUserFlashPageSizeByte() to get the FLASH size of a given page in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetPageSizeByte() to get the FLASH size of a given page in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashPageSizeByte() to get the FLASH size of a given page in FLASH extended USER area.
Call the function HAL_FLASH_GetUserFlashAddrOffset() to get the address offset of a specific page in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetAddrOffset() to get the address offset of a specific page in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashAddrOffset() to get the address offset of a specific page in FLASH extended USER area. The offset is computed from the beginning of the FLASH extended USER area.
Call the function HAL_FLASH_ECC_GetInfo() to get the FLASH ECC information.
Call the function HAL_FLASH_GetInstance() to get the HAL FLASH instance.
Call the function HAL_FLASH_GetLLInstance() to get the hardware FLASH instance.
Call the function HAL_FLASH_GetState() to get the FLASH current state.
Call the function HAL_FLASH_GetLastErrorCodes() to get the FLASH last errors codes.
Call the function HAL_FLASH_SetUserData() to set a user data in the FLASH handle.
Call the function HAL_FLASH_GetUserData() to get a user data from the FLASH handle.
Functions
-
hal_flash_operation_t
HAL_FLASH_GetCurrentOperation
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the current operation on the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
hal_flash_operation_t – Operation ongoing.
-
uint32_t
HAL_FLASH_GetCurrentProgrammedAddr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the last programming operation information.
Note
This function must be called during or directly after a ProgramByAddr operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – FLASH address currently being programmed. 0xFFFFFFFF if no program by address operation is ongoing on the given bank.
-
uint32_t
HAL_FLASH_GetCurrentErasedAddr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the last address erase operation information.
Note
This function must be called during or directly after a EraseByAddr operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – Address of the FLASH page currently being erased. 0xFFFFFFFF if no erase page by address operation is ongoing on the given bank.
-
uint32_t
HAL_FLASH_GetCurrentErasedPage
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the last page erase operation information.
Note
This function must be called during or directly after an ErasePage operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – FLASH page currently being erased. 0xFFFFFFFF if no erase page operation is ongoing on the given bank.
-
void
HAL_FLASH_GetInterruptedByResetOperationInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_interrupted_by_reset_operation_info_t
*
p_info
)
-
Get the interrupted operation information.
Warning
Be aware that if the interrupted operation is either in the EDATA (with EDATA_EN set to 1) or OTP areas, the reported address is not always accurate due to a hardware limitation. Indeed, in this case, the correct address can be one of the following:
Reported address + 0x400
Reported address + 0x200
Reported address
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_info – Pointer to a hal_flash_interrupted_by_reset_operation_info_t structure.
-
void
HAL_FLASH_GetInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_info_t
*
p_info
)
-
Get the user FLASH info (size, number and size of banks, number and size of pages).
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_info – Pointer to a hal_flash_info_t structure.
-
uint32_t
HAL_FLASH_GetSizeByte
(
const
hal_flash_handle_t
*
hflash
)
-
Get the total FLASH size.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – size in bytes of total FLASH.
-
uint8_t
HAL_FLASH_GetBankNbr
(
const
hal_flash_handle_t
*
hflash
)
-
Get the number of FLASH banks.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – number of bank.
-
uint32_t
HAL_FLASH_GetBankSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the total size in bytes of the given FLASH bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – total size in bytes of the given bank.
-
uint32_t
HAL_FLASH_GetUserFlashSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the size in bytes of the user flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – size in bytes of the user flash area of the given bank.
-
uint32_t
HAL_FLASH_EDATA_GetSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the size in bytes of the EDATA flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – size in bytes of the EDATA flash area of the given bank.
-
uint16_t
HAL_FLASH_GetUserFlashPageNbr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the number of pages of the user flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – number of pages of the user flash area of the given bank.
-
uint16_t
HAL_FLASH_EDATA_GetPageNbr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the number of pages of the EDATA flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – number of pages of the EDATA flash area of the given bank.
-
uint32_t
HAL_FLASH_GetUserFlashPageSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the size in bytes of the given user area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Selected page.
- Return values :
-
The – size in bytes of the given user area page.
-
uint32_t
HAL_FLASH_EDATA_GetPageSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the size in bytes of the given EDATA area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Selected page.
- Return values :
-
The – size in bytes of the given EDATA area page.
-
uint32_t
HAL_FLASH_GetUserFlashAddrOffset
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the offset address of the given user area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Page within selected bank.
- Return values :
-
Address – The offset address of the given user area page.
-
uint32_t
HAL_FLASH_EDATA_GetAddrOffset
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the offset address of the given EDATA area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Page within selected bank.
- Return values :
-
Address – The offset address of the given EDATA area page.
-
void
HAL_FLASH_ECC_GetInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
hal_flash_ecc_info_t
*
p_info
)
-
Get the ECC information.
Warning
Be aware that if the error is a ECC single error located either in the EDATA (with EDATA_EN set to 1) or OTP areas, the reported address is not always accurate due to a hardware limitation. Indeed, in this case, the correct address can be one of the following:
Reported address + 0x400
Reported address + 0x200
Reported address
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
p_info – Pointer to a hal_flash_ecc_info_t structure.
-
hal_flash_t
HAL_FLASH_GetInstance
(
const
hal_flash_handle_t
*
hflash
)
-
Get the HAL FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – HAL FLASH instance.
-
FLASH_TypeDef
*
HAL_FLASH_GetLLInstance
(
const
hal_flash_handle_t
*
hflash
)
-
Get the hardware FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – hardware FLASH instance.
-
hal_flash_state_t
HAL_FLASH_GetState
(
const
hal_flash_handle_t
*
hflash
)
-
Get the FLASH current state.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
State – The FLASH global state.
-
uint32_t
HAL_FLASH_GetLastErrorCodes
(
const
hal_flash_handle_t
*
hflash
)
-
Get the FLASH last error codes.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
Error – codes The FLASH last error codes.
-
void
HAL_FLASH_SetUserData
(
hal_flash_handle_t
*
hflash
,
const
void
*
p_user_data
)
-
Store User Data pointer within the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_FLASH_GetUserData
(
const
hal_flash_handle_t
*
hflash
)
-
Retrieve the user data pointer from the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
Pointer – to the user data.
- group FLASH_Exported_Functions_Group5
-
This subsection provides a set of functions allowing access to FLASH data information and status:
Call the function HAL_FLASH_GetCurrentOperation() to get the current flash operation.
Call the function HAL_FLASH_GetCurrentProgrammedAddr() to get the currently being programmed flash address.
Call the function HAL_FLASH_GetCurrentErasedAddr() to get the currently being erased flash address.
Call the function HAL_FLASH_GetCurrentErasedPage() to get the currently being erased flash page.
Call the function HAL_FLASH_GetInterruptedByResetOperationInfo() to get the FLASH interrupted operation information.
Call the function HAL_FLASH_GetInfo() to get the FLASH information.
Call the function HAL_FLASH_GetSizeByte() to get the FLASH total size.
Call the function HAL_FLASH_GetBankNbr() to get the FLASH number of banks.
Call the function HAL_FLASH_GetBankSizeByte() to get the FLASH bank size.
Call the function HAL_FLASH_GetUserFlashSizeByte() to get the FLASH USER area size within a bank.
Call the function HAL_FLASH_EDATA_GetSizeByte() to get the FLASH EDATA area size within a bank
Call the function HAL_FLASH_GetExtUserFlashSizeByte() to get the FLASH Extended USER area size within a bank.
Call the function HAL_FLASH_GetUserFlashPageNbr() to get the number of pages in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetPageNbr() to get the number of pages in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashPageNbr() to get the number of pages in FLASH extended USER area.
Call the function HAL_FLASH_GetUserFlashPageSizeByte() to get the FLASH size of a given page in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetPageSizeByte() to get the FLASH size of a given page in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashPageSizeByte() to get the FLASH size of a given page in FLASH extended USER area.
Call the function HAL_FLASH_GetUserFlashAddrOffset() to get the address offset of a specific page in FLASH USER area.
Call the function HAL_FLASH_EDATA_GetAddrOffset() to get the address offset of a specific page in FLASH EDATA area.
Call the function HAL_FLASH_GetExtUserFlashAddrOffset() to get the address offset of a specific page in FLASH extended USER area. The offset is computed from the beginning of the FLASH extended USER area.
Call the function HAL_FLASH_ECC_GetInfo() to get the FLASH ECC information.
Call the function HAL_FLASH_GetInstance() to get the HAL FLASH instance.
Call the function HAL_FLASH_GetLLInstance() to get the hardware FLASH instance.
Call the function HAL_FLASH_GetState() to get the FLASH current state.
Call the function HAL_FLASH_GetLastErrorCodes() to get the FLASH last errors codes.
Call the function HAL_FLASH_SetUserData() to set a user data in the FLASH handle.
Call the function HAL_FLASH_GetUserData() to get a user data from the FLASH handle.
Functions
-
hal_flash_operation_t
HAL_FLASH_GetCurrentOperation
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the current operation on the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
hal_flash_operation_t – Operation ongoing.
-
uint32_t
HAL_FLASH_GetCurrentProgrammedAddr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the last programming operation information.
Note
This function must be called during or directly after a ProgramByAddr operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – FLASH address currently being programmed. 0xFFFFFFFF if no program by address operation is ongoing on the given bank.
-
uint32_t
HAL_FLASH_GetCurrentErasedAddr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the last address erase operation information.
Note
This function must be called during or directly after a EraseByAddr operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – Address of the FLASH page currently being erased. 0xFFFFFFFF if no erase page by address operation is ongoing on the given bank.
-
uint32_t
HAL_FLASH_GetCurrentErasedPage
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the last page erase operation information.
Note
This function must be called during or directly after an ErasePage operation, otherwise the returned information could not be true anymore.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
uint32_t – FLASH page currently being erased. 0xFFFFFFFF if no erase page operation is ongoing on the given bank.
-
void
HAL_FLASH_GetInterruptedByResetOperationInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_interrupted_by_reset_operation_info_t
*
p_info
)
-
Get the interrupted operation information.
Warning
Be aware that if the interrupted operation is either in the EDATA (with EDATA_EN set to 1) or OTP areas, the reported address is not always accurate due to a hardware limitation. Indeed, in this case, the correct address can be one of the following:
Reported address + 0x400
Reported address + 0x200
Reported address
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_info – Pointer to a hal_flash_interrupted_by_reset_operation_info_t structure.
-
void
HAL_FLASH_GetInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_info_t
*
p_info
)
-
Get the user FLASH info (size, number and size of banks, number and size of pages).
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_info – Pointer to a hal_flash_info_t structure.
-
uint32_t
HAL_FLASH_GetSizeByte
(
const
hal_flash_handle_t
*
hflash
)
-
Get the total FLASH size.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – size in bytes of total FLASH.
-
uint8_t
HAL_FLASH_GetBankNbr
(
const
hal_flash_handle_t
*
hflash
)
-
Get the number of FLASH banks.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – number of bank.
-
uint32_t
HAL_FLASH_GetBankSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the total size in bytes of the given FLASH bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – total size in bytes of the given bank.
-
uint32_t
HAL_FLASH_GetUserFlashSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the size in bytes of the user flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – size in bytes of the user flash area of the given bank.
-
uint32_t
HAL_FLASH_EDATA_GetSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the size in bytes of the EDATA flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – size in bytes of the EDATA flash area of the given bank.
-
uint16_t
HAL_FLASH_GetUserFlashPageNbr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the number of pages of the user flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – number of pages of the user flash area of the given bank.
-
uint16_t
HAL_FLASH_EDATA_GetPageNbr
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
)
-
Get the number of pages of the EDATA flash area of the given bank.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
- Return values :
-
The – number of pages of the EDATA flash area of the given bank.
-
uint32_t
HAL_FLASH_GetUserFlashPageSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the size in bytes of the given user area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Selected page.
- Return values :
-
The – size in bytes of the given user area page.
-
uint32_t
HAL_FLASH_EDATA_GetPageSizeByte
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the size in bytes of the given EDATA area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Selected page.
- Return values :
-
The – size in bytes of the given EDATA area page.
-
uint32_t
HAL_FLASH_GetUserFlashAddrOffset
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the offset address of the given user area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Page within selected bank.
- Return values :
-
Address – The offset address of the given user area page.
-
uint32_t
HAL_FLASH_EDATA_GetAddrOffset
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
uint32_t
page
)
-
Get the offset address of the given EDATA area page.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
page – Page within selected bank.
- Return values :
-
Address – The offset address of the given EDATA area page.
-
void
HAL_FLASH_ECC_GetInfo
(
const
hal_flash_handle_t
*
hflash
,
hal_flash_bank_t
bank
,
hal_flash_ecc_info_t
*
p_info
)
-
Get the ECC information.
Warning
Be aware that if the error is a ECC single error located either in the EDATA (with EDATA_EN set to 1) or OTP areas, the reported address is not always accurate due to a hardware limitation. Indeed, in this case, the correct address can be one of the following:
Reported address + 0x400
Reported address + 0x200
Reported address
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
bank – This parameter can be one of the following values:
p_info – Pointer to a hal_flash_ecc_info_t structure.
-
hal_flash_t
HAL_FLASH_GetInstance
(
const
hal_flash_handle_t
*
hflash
)
-
Get the HAL FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – HAL FLASH instance.
-
FLASH_TypeDef
*
HAL_FLASH_GetLLInstance
(
const
hal_flash_handle_t
*
hflash
)
-
Get the hardware FLASH instance.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
The – hardware FLASH instance.
-
hal_flash_state_t
HAL_FLASH_GetState
(
const
hal_flash_handle_t
*
hflash
)
-
Get the FLASH current state.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
State – The FLASH global state.
-
uint32_t
HAL_FLASH_GetLastErrorCodes
(
const
hal_flash_handle_t
*
hflash
)
-
Get the FLASH last error codes.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
Error – codes The FLASH last error codes.
-
void
HAL_FLASH_SetUserData
(
hal_flash_handle_t
*
hflash
,
const
void
*
p_user_data
)
-
Store User Data pointer within the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_FLASH_GetUserData
(
const
hal_flash_handle_t
*
hflash
)
-
Retrieve the user data pointer from the FLASH handle.
- Parameters :
-
hflash – Pointer to a hal_flash_handle_t structure.
- Return values :
-
Pointer – to the user data.