Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
Option Bytes Programming functions
[FLASH_Private_Functions]
Option Bytes Programming functions. More...
Functions | |
void | FLASH_OB_Unlock (void) |
Unlocks the option bytes block access. | |
void | FLASH_OB_Lock (void) |
Locks the option bytes block access. | |
void | FLASH_OB_Launch (void) |
Launch the option byte loading. | |
FLASH_Status | FLASH_OB_Erase (void) |
Erases the FLASH option bytes. | |
FLASH_Status | FLASH_OB_EnableWRP (uint32_t OB_WRP) |
Write protects the desired pages. | |
FLASH_Status | FLASH_OB_RDPConfig (uint8_t OB_RDP) |
Enables or disables the read out protection. | |
FLASH_Status | FLASH_OB_UserConfig (uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY) |
Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. | |
FLASH_Status | FLASH_OB_BOOTConfig (uint8_t OB_BOOT1) |
Sets or resets the BOOT1. | |
FLASH_Status | FLASH_OB_VDDAConfig (uint8_t OB_VDDA_ANALOG) |
Sets or resets the analogue monitoring on VDDA Power source. | |
FLASH_Status | FLASH_OB_SRAMParityConfig (uint8_t OB_SRAM_Parity) |
Sets or resets the SRAM parity. | |
FLASH_Status | FLASH_OB_WriteUser (uint8_t OB_USER) |
Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY/ BOOT1 and OB_VDDA_ANALOG. | |
FLASH_Status | FLASH_ProgramOptionByteData (uint32_t Address, uint8_t Data) |
Programs a half word at a specified Option Byte Data address. | |
uint8_t | FLASH_OB_GetUser (void) |
Returns the FLASH User Option Bytes values. | |
uint32_t | FLASH_OB_GetWRP (void) |
Returns the FLASH Write Protection Option Bytes value. | |
FlagStatus | FLASH_OB_GetRDP (void) |
Checks whether the FLASH Read out Protection Status is set or not. |
Detailed Description
Option Bytes Programming functions.
=============================================================================== ##### Option Bytes Programming functions ##### =============================================================================== [..] This group includes the following functions: (+) void FLASH_OB_Unlock(void); (+) void FLASH_OB_Lock(void); (+) void FLASH_OB_Erase(void); (+) FLASH_Status FLASH_OB_WRPConfig(uint32_t OB_WRP, FunctionalState NewState); (+) FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP); (+) FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY); (+) FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1); (+) FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG); (+) FLASH_Status FLASH_OB_SRMParityConfig(uint8_t OB_SRAM_Parity); (+) FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER); (+) FLASH_Status FLASH_OB_Launch(void); (+) uint32_t FLASH_OB_GetUser(void); (+) uint8_t FLASH_OB_GetWRP(void); (+) uint8_t FLASH_OB_GetRDP(void); [..] Any operation of erase or program should follow these steps: (#) Call the FLASH_OB_Unlock() function to enable the FLASH option control register access. (#) Call one or several functions to program the desired Option Bytes: (++) void FLASH_OB_WRPConfig(uint32_t OB_WRP, FunctionalState NewState); => to Enable/Disable the desired sector write protection. (++) FLASH_Status FLASH_OB_RDPConfig(uint8_t OB_RDP) => to set the desired read Protection Level. (++) FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY); => to configure the user Option Bytes. (++) FLASH_Status FLASH_OB_BOOTConfig(uint8_t OB_BOOT1); => to set the boot1 mode (++) FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG); => to Enable/Disable the VDDA monitoring. (++) FLASH_Status FLASH_OB_SRMParityConfig(uint8_t OB_SRAM_Parity); => to Enable/Disable the SRAM Parity check. (++) FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER); => to write all user option bytes: OB_IWDG, OB_STOP, OB_STDBY, OB_BOOT1, OB_VDDA_ANALOG and OB_VDD_SD12. (#) Once all needed Option Bytes to be programmed are correctly written, call the FLASH_OB_Launch() function to launch the Option Bytes programming process. (#@) When changing the IWDG mode from HW to SW or from SW to HW, a system reset is needed to make the change effective. (#) Call the FLASH_OB_Lock() function to disable the FLASH option control register access (recommended to protect the Option Bytes against possible unwanted operations).
Function Documentation
FLASH_Status FLASH_OB_BOOTConfig | ( | uint8_t | OB_BOOT1 ) |
Sets or resets the BOOT1.
- Parameters:
-
OB_BOOT1,: Set or Reset the BOOT1. This parameter can be one of the following values: - OB_BOOT1_RESET: BOOT1 Reset
- OB_BOOT1_SET: BOOT1 Set
- Return values:
-
None
Definition at line 774 of file stm32f30x_flash.c.
FLASH_Status FLASH_OB_EnableWRP | ( | uint32_t | OB_WRP ) |
Write protects the desired pages.
- Note:
- To correctly run this function, the FLASH_OB_Unlock() function must be called before.
- Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters:
-
OB_WRP,: specifies the address of the pages to be write protected. This parameter can be: - value between OB_WRP_Pages0to35 and OB_WRP_Pages60to63
- OB_WRP_AllPages
- Return values:
-
FLASH Status: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Definition at line 591 of file stm32f30x_flash.c.
FLASH_Status FLASH_OB_Erase | ( | void | ) |
Erases the FLASH option bytes.
- Note:
- This functions erases all option bytes except the Read protection (RDP).
- Parameters:
-
None
- Return values:
-
FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Definition at line 521 of file stm32f30x_flash.c.
FlagStatus FLASH_OB_GetRDP | ( | void | ) |
Checks whether the FLASH Read out Protection Status is set or not.
- Parameters:
-
None
- Return values:
-
FLASH ReadOut Protection Status(SET or RESET)
Definition at line 1001 of file stm32f30x_flash.c.
uint8_t FLASH_OB_GetUser | ( | void | ) |
Returns the FLASH User Option Bytes values.
- Parameters:
-
None
- Return values:
-
The FLASH User Option Bytes .
Definition at line 979 of file stm32f30x_flash.c.
uint32_t FLASH_OB_GetWRP | ( | void | ) |
Returns the FLASH Write Protection Option Bytes value.
- Parameters:
-
None
- Return values:
-
The FLASH Write Protection Option Bytes value
Definition at line 990 of file stm32f30x_flash.c.
void FLASH_OB_Launch | ( | void | ) |
Launch the option byte loading.
- Parameters:
-
None
- Return values:
-
None
Definition at line 508 of file stm32f30x_flash.c.
void FLASH_OB_Lock | ( | void | ) |
Locks the option bytes block access.
- Parameters:
-
None
- Return values:
-
None
Definition at line 497 of file stm32f30x_flash.c.
FLASH_Status FLASH_OB_RDPConfig | ( | uint8_t | OB_RDP ) |
Enables or disables the read out protection.
- Note:
- To correctly run this function, the FLASH_OB_Unlock() function must be called before.
- Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters:
-
FLASH_ReadProtection_Level,: specifies the read protection level. This parameter can be: - OB_RDP_Level_0: No protection
- OB_RDP_Level_1: Read protection of the memory
- OB_RDP_Level_2: Chip protection
- Return values:
-
FLASH Status: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Definition at line 665 of file stm32f30x_flash.c.
FLASH_Status FLASH_OB_SRAMParityConfig | ( | uint8_t | OB_SRAM_Parity ) |
Sets or resets the SRAM parity.
- Parameters:
-
OB_SRAM_Parity,: Set or Reset the SRAM parity enable bit. This parameter can be one of the following values: - OB_SRAM_PARITY_SET: Set SRAM parity.
- OB_SRAM_PARITY_RESET: Reset SRAM parity.
- Return values:
-
None
Definition at line 858 of file stm32f30x_flash.c.
void FLASH_OB_Unlock | ( | void | ) |
Unlocks the option bytes block access.
- Parameters:
-
None
- Return values:
-
None
Definition at line 482 of file stm32f30x_flash.c.
FLASH_Status FLASH_OB_UserConfig | ( | uint8_t | OB_IWDG, |
uint8_t | OB_STOP, | ||
uint8_t | OB_STDBY | ||
) |
Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
- Parameters:
-
OB_IWDG,: Selects the IWDG mode This parameter can be one of the following values: - OB_IWDG_SW: Software IWDG selected
- OB_IWDG_HW: Hardware IWDG selected
OB_STOP,: Reset event when entering STOP mode. This parameter can be one of the following values: - OB_STOP_NoRST: No reset generated when entering in STOP
- OB_STOP_RST: Reset generated when entering in STOP
OB_STDBY,: Reset event when entering Standby mode. This parameter can be one of the following values: - OB_STDBY_NoRST: No reset generated when entering in STANDBY
- OB_STDBY_RST: Reset generated when entering in STANDBY
- Return values:
-
FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Definition at line 730 of file stm32f30x_flash.c.
FLASH_Status FLASH_OB_VDDAConfig | ( | uint8_t | OB_VDDA_ANALOG ) |
Sets or resets the analogue monitoring on VDDA Power source.
- Parameters:
-
OB_VDDA_ANALOG,: Selects the analog monitoring on VDDA Power source. This parameter can be one of the following values: - OB_VDDA_ANALOG_ON: Analog monitoring on VDDA Power source ON
- OB_VDDA_ANALOG_OFF: Analog monitoring on VDDA Power source OFF
- Return values:
-
None
Definition at line 816 of file stm32f30x_flash.c.
FLASH_Status FLASH_OB_WriteUser | ( | uint8_t | OB_USER ) |
Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY/ BOOT1 and OB_VDDA_ANALOG.
- Note:
- To correctly run this function, the FLASH_OB_Unlock() function must be called before.
- Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters:
-
OB_USER,: Selects all user option bytes This parameter is a combination of the following values: - OB_IWDG_SW / OB_IWDG_HW: Software / Hardware WDG selected
- OB_STOP_NoRST / OB_STOP_RST: No reset / Reset generated when entering in STOP
- OB_STDBY_NoRST / OB_STDBY_RST: No reset / Reset generated when entering in STANDBY
- OB_BOOT1_RESET / OB_BOOT1_SET: BOOT1 Reset / Set
- OB_VDDA_ANALOG_ON / OB_VDDA_ANALOG_OFF: Analog monitoring on VDDA Power source ON / OFF
- Return values:
-
FLASH Status: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Definition at line 904 of file stm32f30x_flash.c.
FLASH_Status FLASH_ProgramOptionByteData | ( | uint32_t | Address, |
uint8_t | Data | ||
) |
Programs a half word at a specified Option Byte Data address.
- Note:
- To correctly run this function, the FLASH_OB_Unlock() function must be called before. Call the FLASH_OB_Lock() to disable the flash control register access and the option bytes (recommended to protect the FLASH memory against possible unwanted operation)
- Parameters:
-
Address,: specifies the address to be programmed. This parameter can be 0x1FFFF804 or 0x1FFFF806. Data,: specifies the data to be programmed.
- Return values:
-
FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
Definition at line 948 of file stm32f30x_flash.c.
Generated on Tue Jul 12 2022 17:34:45 by
