HAL FLASH ITF Functions

FLASH ITF Control and Lock/Unlock functions

group FLASH_ITF_Exported_Functions_Group1

This subsection provides a set of functions allowing lock/unlock and configuration of the FLASH ITF peripheral:

Functions

hal_status_t HAL_FLASH_ITF_Lock ( hal_flash_t instance )

Lock the FLASH control register access.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH control register access locked.

  • HAL_ERROR – Failed to lock FLASH control register access.

hal_status_t HAL_FLASH_ITF_Unlock ( hal_flash_t instance )

Unlock the FLASH control register access.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH control register access unlocked.

  • HAL_ERROR – Failed to unlock FLASH control register access.

hal_flash_itf_lock_status_t HAL_FLASH_ITF_IsLocked ( hal_flash_t instance )

Check if the FLASH control register access is locked or unlocked.

Parameters :

instance – The FLASH instance.

Return values :

Returned – value can be one element of hal_flash_itf_lock_status_t enumeration.

hal_status_t HAL_FLASH_ITF_SetLatency ( hal_flash_t instance , hal_flash_itf_latency_t latency )

Set the FLASH latency configuration.

Parameters :
  • instance – The FLASH instance.

  • latency – This parameter is one element of hal_flash_itf_latency_t enumeration.

Return values :

HAL_OK – Latency is successfully configured.

hal_flash_itf_latency_t HAL_FLASH_ITF_GetLatency ( hal_flash_t instance )

Get the FLASH latency configuration.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_latency_t – Latency value.

hal_status_t HAL_FLASH_ITF_SetProgrammingDelay ( hal_flash_t instance , hal_flash_itf_program_delay_t prog_delay )

Set the FLASH programming delay configuration.

Parameters :
Return values :

HAL_OK – Programming Delay is successfully configured.

hal_flash_itf_program_delay_t HAL_FLASH_ITF_GetProgrammingDelay ( hal_flash_t instance )

Get the FLASH programming delay configuration.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_program_delay_t – programming delay value.

hal_status_t HAL_FLASH_ITF_EnablePrefetch ( hal_flash_t instance )

Enable the FLASH prefetch.

Parameters :

instance – The FLASH instance.

Return values :

HAL_OK – Prefetch enabled.

hal_status_t HAL_FLASH_ITF_DisablePrefetch ( hal_flash_t instance )

Disable the FLASH prefetch.

Parameters :

instance – The FLASH instance.

Return values :

HAL_OK – Prefetch disabled.

hal_flash_itf_prefetch_status_t HAL_FLASH_ITF_IsEnabledPrefetch ( hal_flash_t instance )

Check if the FLASH prefetch is enabled or disabled.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_prefetch_status_t – Prefetch status.

hal_status_t HAL_FLASH_ITF_SetEmptyBootLocation ( hal_flash_t instance , hal_flash_itf_empty_boot_location_t empty_boot )

Set the FLASH empty boot location status.

Parameters :
Return values :

HAL_OK – Empty boot location status is successfully configured.

hal_flash_itf_empty_boot_location_t HAL_FLASH_ITF_GetEmptyBootLocation ( hal_flash_t instance )

Get the FLASH empty boot location status.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_empty_boot_location_t – Empty boot location status.

hal_status_t HAL_FLASH_ITF_SetHDPExtArea ( hal_flash_t instance , hal_flash_bank_t bank , uint32_t page_nbr )

Set the FLASH HDP Extended area.

Parameters :
  • instance – The FLASH instance.

  • bank – This parameter can be one of the following values:

  • page_nbr – This parameter can be any value between 0 and the maximum number of pages per bank.

Return values :

HAL_OK – FLASH HDP Extended area number of pages set.

uint32_t HAL_FLASH_ITF_GetHDPExtArea ( hal_flash_t instance , hal_flash_bank_t bank )

Get the FLASH HDP Extended area number of pages.

Parameters :
Return values :

uint32_t – FLASH HDP Extended area number of pages value, between 0 and the maximum number of pages per bank.

hal_flash_itf_rdp_key_lock_status_t HAL_FLASH_ITF_IsLockedRDPOEMKey ( hal_flash_t instance )

Check if the FLASH Readout Protection OEM key is locked or unlocked.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_rdp_key_lock_status_t – Readout Protection OEM key lock status.

hal_flash_itf_rdp_key_lock_status_t HAL_FLASH_ITF_IsLockedRDPBSKey ( hal_flash_t instance )

Check if the FLASH Readout Protection BS key is locked or unlocked.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_rdp_key_lock_status_t – Readout Protection BS key lock status.

hal_status_t HAL_FLASH_ITF_ECC_EnableIT ( hal_flash_t instance , uint32_t interrupt )

Enable the given FLASH ECC interrupt.

Parameters :
  • instance – The FLASH instance.

  • interrupt – The ECC interrupt to enable.

Return values :

HAL_OK – ECC interruption enabled.

hal_status_t HAL_FLASH_ITF_ECC_DisableIT ( hal_flash_t instance , uint32_t interrupt )

Disable the given FLASH ECC interrupt.

Parameters :
  • instance – The FLASH instance.

  • interrupt – The ECC interrupt to disable.

Return values :

HAL_OK – ECC interruption disabled.

hal_flash_itf_ecc_it_status_t HAL_FLASH_ITF_ECC_IsEnabledIT ( hal_flash_t instance , uint32_t interrupt )

Check if the given FLASH ECC interrupt is enabled or disabled.

Parameters :
  • instance – The FLASH instance.

  • interrupt – The ECC interrupt to check.

Return values :

Return – value can be one element of hal_flash_itf_ecc_it_status_t enumeration.

FLASH ITF Option bytes configuration functions

group FLASH_ITF_Exported_Functions_Group2

This subsection provides a set of functions allowing configuration of the FLASH peripheral option bytes:

Functions

hal_status_t HAL_FLASH_ITF_OB_Lock ( hal_flash_t instance )

Lock the FLASH OB control register access.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH OB control register access is successfully locked.

  • HAL_ERROR – Failed to lock FLASH OB control register access.

hal_status_t HAL_FLASH_ITF_OB_Unlock ( hal_flash_t instance )

Unlock the FLASH OB control register access.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH OB control register access is successfully unlocked.

  • HAL_ERROR – Failed to unlock FLASH OB control register access

hal_flash_itf_ob_lock_status_t HAL_FLASH_ITF_OB_IsLocked ( hal_flash_t instance )

Check if the FLASH OB control register access is locked or unlocked.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_lock_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_LockOTPBlock ( hal_flash_t instance , uint32_t start_otp_block , uint32_t otp_block_nbr )

Lock the selected blocks of the OTP flash area.

Note

To configure the locked OTP blocks, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • start_otp_block – Start OTP block. This parameter can take any value from 0 to 23.

  • otp_block_nbr – OTP block number. This parameter can take any value from 1 to 24.

Return values :
  • HAL_OK – FLASH OB OTP blocks are successfully locked.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_otp_blk_lock_status_t HAL_FLASH_ITF_OB_IsLockedOTPBlock ( hal_flash_t instance , uint32_t otp_block )

Check if the selected OTP blocks are locked.

Parameters :
  • instance – The FLASH instance.

  • otp_block – OTP block to check. This parameter can take any value from 0 to 23.

Return values :

Return – value can be one element of hal_flash_itf_ob_otp_blk_lock_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_EnablePageWRP ( hal_flash_t instance , hal_flash_bank_t bank , uint32_t start_page , uint32_t page_nbr )

Enable the write protection feature on the selected pages of the given bank.

Note

To configure the write protected pages, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • bank – This parameter can be one of the following values:

  • start_page – Starting page number for enabling write protection. This parameter can be any value between 0 and (FLASH_PAGE_NB - 1).

  • page_nbr – Number of pages to be write protected. This parameter can be any value between 1 and FLASH_PAGE_NB.

Return values :
  • HAL_OK – FLASH OB write protection area is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_status_t HAL_FLASH_ITF_OB_DisablePageWRP ( hal_flash_t instance , hal_flash_bank_t bank , uint32_t start_page , uint32_t page_nbr )

Disable the write protection feature on the selected pages of the given bank.

Note

To configure the write protected pages, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • bank – This parameter can be one of the following values:

  • start_page – Starting page number for disabling write protection. This parameter can be any value between 0 and (FLASH_PAGE_NB - 1).

  • page_nbr – Number of pages for disabling write protection. This parameter can be any value between 1 and FLASH_PAGE_NB.

Return values :
  • HAL_OK – FLASH OB write protection area is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_wrp_page_status_t HAL_FLASH_ITF_OB_IsEnabledPageWRP ( hal_flash_t instance , hal_flash_bank_t bank , uint32_t page )

Get the state of page write protection configuration for the selected pages of the given bank.

Parameters :
  • instance – The FLASH instance.

  • bank – This parameter can be one of the following values:

  • page – This parameter can be any value between 0 and FLASH_PAGE_NB.

Return values :

Return – value can be one element of hal_flash_itf_ob_wrp_page_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_EnableEDATAArea ( hal_flash_t instance )

Enable the data flash area.

Note

Before enabling the data flash area, the option lock bit OPTLOCK must be previously cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH OB data FLASH is successfully enabled.

  • HAL_ERROR – FLASH OB write error generated.

hal_status_t HAL_FLASH_ITF_OB_DisableEDATAArea ( hal_flash_t instance )

Disable the data flash area.

Note

To disable the data flash area, the option lock bit OPTLOCK mustbe cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH OB data FLASH is successfully disabled.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_edata_area_status_t HAL_FLASH_ITF_OB_IsEnabledEDATAArea ( hal_flash_t instance )

Check if the data flash area of the selected bank is enabled or not.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_edata_area_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetHDPArea ( hal_flash_t instance , hal_flash_bank_t bank , uint32_t start_page , uint32_t page_nbr )

Set the HDP area.

Note

To configure the HDP area start page, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • bank – This parameter can be one of the following values:

  • start_page – This parameter can take any value between 0 and the maximum number of pages.

  • page_nbr – Number of page of the hide protection area.

Return values :
  • HAL_OK – FLASH OB HDP area start page is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

void HAL_FLASH_ITF_OB_GetHDPArea ( hal_flash_t instance , hal_flash_bank_t bank , uint32_t * p_start_page , uint32_t * p_page_nbr )

Get the hide protection area configuration.

Parameters :
  • instance – The FLASH instance.

  • bank – This parameter can be one of the following values:

  • p_start_page – Pointer to start page of the hide protection area.

  • p_page_nbr – Pointer to number of page of the hide protection area.

hal_status_t HAL_FLASH_ITF_OB_SetRDPLevel ( hal_flash_t instance , hal_flash_itf_ob_rdp_level_t rdp_level )

Set the RDP level.

Note

To configure the RDP level, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB RDP level is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_rdp_level_t HAL_FLASH_ITF_OB_GetRDPLevel ( hal_flash_t instance )

Get the FLASH OB RDP level configuration.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_rdp_level_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetRDPOEMKey ( hal_flash_t instance , const hal_flash_itf_ob_rdp_oem_key_t * p_key )

Set the FLASH OB OEM key configuration.

Note

To configure the OEM key, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • p_key – Pointer to the key value.

Return values :
  • HAL_OK – FLASH OB OEM key is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_status_t HAL_FLASH_ITF_OB_SetRDPBSKey ( hal_flash_t instance , const hal_flash_itf_ob_rdp_bs_key_t * p_key )

Set the FLASH OB BS key configuration.

Note

To configure the BS key, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • p_key – Pointer to the key value.

Return values :
  • HAL_OK – FLASH OB BS key is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_status_t HAL_FLASH_ITF_OB_SetEnterLowPWRModeRstGeneration ( hal_flash_t instance , uint32_t low_pwr_mode , hal_flash_itf_ob_rst_generation_status_t rst_gen )

Set the FLASH OB enter stop mode reset generation configuration.

Note

To configure the reset generation upon entering stop mode, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB enter low-power mode reset generation is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_rst_generation_status_t HAL_FLASH_ITF_OB_GetEnterLowPWRModeRstGeneration ( hal_flash_t instance , uint32_t low_pwr_mode )

Get the FLASH OB enter stop mode reset generation configuration.

Parameters :
Return values :

Return – value can be one element of hal_flash_itf_ob_rst_generation_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetSystemRstSRAMErase ( hal_flash_t instance , uint32_t sram , hal_flash_itf_ob_sys_rst_sram_erase_t sram_erase )

Set the FLASH OB system reset SRAM erase configuration.

Note

To configure the SRAM erase upon system reset, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB erase SRAM on system reset is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_sys_rst_sram_erase_t HAL_FLASH_ITF_OB_GetSystemRstSRAMErase ( hal_flash_t instance , uint32_t sram )

Get the FLASH OB system reset SRAM erase configuration.

Parameters :
Return values :

Return – value can be one element of hal_flash_itf_ob_sys_rst_sram_erase_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetIWDGMode ( hal_flash_t instance , hal_flash_itf_ob_wdg_mode_t mode )

Set the FLASH OB IWDG mode configuration.

Note

To configure the IWDG control mode, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB IWDG mode is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_wdg_mode_t HAL_FLASH_ITF_OB_GetIWDGMode ( hal_flash_t instance )

Get the FLASH OB IWDG mode configuration.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_wdg_mode_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetWWDGMode ( hal_flash_t instance , hal_flash_itf_ob_wdg_mode_t mode )

Set the FLASH OB WWDG mode configuration.

Note

To configure the WWDG control mode, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB WWDG mode is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_wdg_mode_t HAL_FLASH_ITF_OB_GetWWDGMode ( hal_flash_t instance )

Get the FLASH OB WWDG mode configuration.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_wdg_mode_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_FreezeIWDGCounterLowPWRMode ( hal_flash_t instance , uint32_t low_pwr_mode )

Freeze the FLASH OB IWDG counter in low power mode configuration.

Note

To configure the IWDG freeze in low-power mode, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB IWDG counter is frozen in specified low-power mode.

  • HAL_ERROR – FLASH OB write error generated.

hal_status_t HAL_FLASH_ITF_OB_UnfreezeIWDGCounterLowPWRMode ( hal_flash_t instance , uint32_t low_pwr_mode )

Unfreeze the FLASH OB IWDG counter in low-power mode configuration.

Note

To configure the IWDG freeze in low-power mode, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB IWDG counter is not frozen in specified low-power mode.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_wdg_freeze_status_t HAL_FLASH_ITF_OB_IsFrozenIWDGCounterLowPWRMode ( hal_flash_t instance , uint32_t low_pwr_mode )

Check the FLASH OB freeze IWDG counter in low-power mode configuration.

Parameters :
Return values :

Return – value can be one element of hal_flash_itf_ob_wdg_freeze_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetBootSelection ( hal_flash_t instance , hal_flash_itf_ob_boot_selection_t boot_select )

Set the FLASH ITF OB boot0 configuration.

Parameters :
Return values :
  • HAL_OK – FLASH ITF OB boot0 is successfully configured.

  • HAL_ERROR – FLASH ITF OB write error generated.

hal_flash_itf_ob_boot_selection_t HAL_FLASH_ITF_OB_GetBootSelection ( hal_flash_t instance )

Get the FLASH ITF OB boot0 source selection configuration.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_ob_boot_selection_t – FLASH ITF OB boot0 source selected.

hal_status_t HAL_FLASH_ITF_OB_SetBoot0 ( hal_flash_t instance , hal_flash_itf_ob_boot_state_t state )

Set the FLASH ITF OB boot0 option bit state configuration.

Parameters :
Return values :
  • HAL_OK – FLASH ITF OB boot0 is successfully configured.

  • HAL_ERROR – FLASH ITF OB write error generated.

hal_flash_itf_ob_boot_state_t HAL_FLASH_ITF_OB_GetBoot0 ( hal_flash_t instance )

Get the FLASH ITF OB boot0 option bit state configuration.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_ob_boot_selection_t – FLASH ITF OB boot0 option bit state configuration.

hal_status_t HAL_FLASH_ITF_OB_SetBankTopology ( hal_flash_t instance , hal_flash_itf_ob_topology_t bank_topology )

Set the FLASH ITF OB single/dual bank configuration for products with less user memory.

Note

Before setting the bank topology, the option lock bit OPTLOCK must be previously cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB single-bank option bit value is successfully enabled.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_topology_t HAL_FLASH_ITF_OB_GetBankTopology ( hal_flash_t instance )

Get the FLASH ITF OB single/dual bank configuration.

Parameters :

instance – The FLASH instance.

Return values :

hal_flash_itf_ob_topology_t – FLASH ITF OB single/dual bank configuration.

hal_status_t HAL_FLASH_ITF_OB_SetBankSwap ( hal_flash_t instance , hal_flash_itf_ob_bank_swap_t bank_swap )

Set the FLASH OB bank swapping configuration.

Note

To configure the bank swapping, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
Return values :
  • HAL_OK – FLASH OB bank swapping is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_bank_swap_t HAL_FLASH_ITF_OB_GetBankSwap ( hal_flash_t instance )

Get the FLASH OB bank swapping configuration.

Note

This function returns the programmed option byte swap bank setting.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_bank_swap_t enumeration.

hal_flash_itf_ob_bank_swap_status_t HAL_FLASH_ITF_OB_IsBankSwapped ( hal_flash_t instance )

Check the FLASH OB bank swapping state.

Note

This function returns the current effective bank swapping status.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_bank_swap_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_EnableSRAMECC ( hal_flash_t instance , uint32_t sram )

Enable the FLASH OB SRAM ECC configuration.

Note

To configure the SRAM ECC feature, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • sram – This parameter can take one of the following values:

Return values :
  • HAL_OK – FLASH OB SRAM ECC is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_status_t HAL_FLASH_ITF_OB_DisableSRAMECC ( hal_flash_t instance , uint32_t sram )

Disable the FLASH OB SRAM ECC configuration.

Note

To configure the SRAM ECC feature, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • sram – This parameter can take one of the following values:

Return values :
  • HAL_OK – FLASH OB SRAM ECC is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_sram_ecc_status_t HAL_FLASH_ITF_OB_IsEnabledSRAMECC ( hal_flash_t instance , uint32_t sram )

Check the FLASH OB SRAM2 ECC configuration is enabled or disabled.

Parameters :
  • instance – The FLASH instance.

  • sram – This parameter can take one of the following values:

Return values :

Return – value can be one element of hal_flash_itf_ob_sram_ecc_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetBootAddr ( hal_flash_t instance , uint32_t boot_addr )

Set the FLASH OB unique boot address configuration.

Note

To configure the boot address, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • boot_addr – Boot address to be configured.

Return values :
  • HAL_OK – FLASH OB boot address is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

  • HAL_INVALID_PARAM – FLASH OB boot address out of bounds.

uint32_t HAL_FLASH_ITF_OB_GetBootAddr ( hal_flash_t instance )

Get the FLASH OB unique boot address 0 configuration.

Parameters :

instance – The FLASH instance.

Return values :

Return – the configured boot address.

hal_status_t HAL_FLASH_ITF_OB_LockBootConfig ( hal_flash_t instance )

Lock FLASH OB unique boot address.

Note

To configure the boot address lock, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH OB boot address is successfully locked.

  • HAL_ERROR – FLASH OB write error generated.

hal_status_t HAL_FLASH_ITF_OB_UnlockBootConfig ( hal_flash_t instance )

Unlock FLASH OB unique boot address.

Note

To configure the boot address lock, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_OK – FLASH OB boot address is successfully unlocked.

  • HAL_ERROR – FLASH OB write error generated.

hal_flash_itf_ob_boot_lock_status_t HAL_FLASH_ITF_OB_IsLockedBootConfig ( hal_flash_t instance )

Check if the FLASH OB unique boot address is locked or not.

Parameters :

instance – The FLASH instance.

Return values :

Return – value can be one element of hal_flash_itf_ob_boot_lock_status_t enumeration.

hal_status_t HAL_FLASH_ITF_OB_SetBootloaderInterfaceConfig ( hal_flash_t instance , uint32_t bootloader_config )

Set the bootloader interface configuration to the specified value.

Note

To configure the bootloader interface, the option lock bit OPTLOCK must be cleared with the call of the HAL_FLASH_ITF_OB_Unlock() function.

Parameters :
  • instance – The FLASH instance.

  • bootloader_config – This parameter can be any value between 0x00000000 and 0xFFFFFFFF.

Return values :
  • HAL_OK – FLASH OB bootloader configuration is successfully configured.

  • HAL_ERROR – FLASH OB write error generated.

uint32_t HAL_FLASH_ITF_OB_GetBootloaderInterfaceConfig ( hal_flash_t instance )

Get the bootloader interface configuration.

Parameters :

instance – The FLASH instance.

Return values :

Returned – value can be any value between 0x00000000 and 0xFFFFFFFF.

FLASH ITF IRQHandler and callback functions

group FLASH_ITF_Exported_Functions_Group3

This subsection provides a set of functions allowing handling of the FLASH ITF interrupt subroutines:

Functions

void HAL_FLASH_ITF_IRQHandler ( hal_flash_t instance )

Handle the FLASH ITF interrupt request.

Parameters :

instance – The FLASH instance.

void HAL_FLASH_ITF_OB_ProgramCpltCallback ( hal_flash_t instance )

FLASH ITF option bytes write complete callback.

Parameters :

instance – The FLASH instance.

void HAL_FLASH_ITF_OB_ErrorCallback ( hal_flash_t instance )

FLASH ITF option bytes write error callback.

Parameters :

instance – The FLASH instance.

FLASH ITF program option bytes functions configuration

group FLASH_ITF_Exported_Functions_Group4

This subsection provides a set of functions allowing programming of the option bytes functions configuration:

Functions

hal_status_t HAL_FLASH_ITF_OB_Program ( hal_flash_t instance )

Program the FLASH ITF option bytes.

Parameters :

instance – The FLASH instance.

Return values :
  • HAL_ERROR – Generated when an error occurred.

  • HAL_TIMEOUT – User timeout.

  • HAL_OK – No error occurred.

hal_status_t HAL_FLASH_ITF_OB_Program_IT ( hal_flash_t instance )

Program the FLASH Option Bytes interface settings in interrupt mode.

Parameters :

instance – Specifies the FLASH instance based on hal_flash_t enumeration.

Return values :

HAL_OK – FLASH Option Bytes settings successfully programmed.

FLASH ITF privileged access levels attributes management functions

group FLASH_ITF_Exported_Functions_Group5

This subsection provides a set of functions allowing management of privileged access level attributes:

Functions

hal_status_t HAL_FLASH_ITF_SetPrivAttr ( hal_flash_t instance , uint32_t item , hal_flash_itf_priv_attr_t priv_attr )

Set privilege attribute.

Parameters :
Return values :
  • HAL_ERROR – The function is called in unprivileged mode.

  • HAL_OK – Privilege attribute has been correctly set.

hal_flash_itf_priv_attr_t HAL_FLASH_ITF_GetPrivAttr ( hal_flash_t instance , uint32_t item )

Get privilege attribute.

Parameters :
  • instance – The FLASH instance.

  • item – The item attribute to be queried. This parameter can be the following value:

Return values :

hal_flash_itf_priv_attr_t – Returned value is an element of hal_flash_itf_priv_attr_t enumeration: