Functions

Option Bytes Programming functions. More...

Collaboration diagram for Option Bytes Programming functions:

Functions

FLASH_Status FLASH_OB_BOOTConfig (uint8_t OB_BOOT1)
 Sets or resets the BOOT1. More...
 
void FLASH_OB_BORConfig (uint8_t OB_BOR)
 Sets the BOR Level. More...
 
FLASH_Status FLASH_OB_EnableWRP (uint32_t OB_WRP)
 Write protects the desired pages. More...
 
FLASH_Status FLASH_OB_Erase (void)
 Erases the FLASH option bytes. More...
 
uint8_t FLASH_OB_GetBOR (void)
 Returns the FLASH BOR level. More...
 
FlagStatus FLASH_OB_GetRDP (void)
 Returns the FLASH Read Protection level. More...
 
uint8_t FLASH_OB_GetUser (void)
 Returns the FLASH User Option Bytes values. More...
 
uint16_t FLASH_OB_GetWRP (void)
 Returns the FLASH Write Protection Option Bytes value. More...
 
uint16_t FLASH_OB_GetWRP1 (void)
 Returns the FLASH Write Protection Option Bytes value. More...
 
FLASH_Status FLASH_OB_Launch (void)
 Launch the option byte loading. More...
 
void FLASH_OB_Lock (void)
 Locks the FLASH Option Control Registers access. More...
 
void FLASH_OB_RDPConfig (uint8_t OB_RDP)
 Sets the read protection level. More...
 
FLASH_Status FLASH_OB_SRAMParityConfig (uint8_t OB_SRAM_Parity)
 Sets or resets the SRAM partiy. More...
 
void FLASH_OB_Unlock (void)
 Unlocks the FLASH Option Control Registers access. More...
 
void 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. More...
 
FLASH_Status FLASH_OB_VDDAConfig (uint8_t OB_VDDA_ANALOG)
 Sets or resets the analogue monitoring on VDDA Power source. More...
 
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. More...
 
void FLASH_OB_WRP1Config (uint32_t OB_WRP, FunctionalState NewState)
 Enables or disables the write protection of the desired sectors. More...
 
void FLASH_OB_WRPConfig (uint32_t OB_WRP, FunctionalState NewState)
 Enables or disables the write protection of the desired sectors. More...
 
FLASH_Status FLASH_ProgramOptionByteData (uint32_t Address, uint8_t Data)
 Programs a half word at a specified Option Byte Data address. More...
 

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_WRPConfig(uint32_t OB_WRP, FunctionalState NewState)
      (+) void FLASH_OB_WRP1Config(uint32_t OB_WRP, FunctionalState NewState)  
      (+) void FLASH_OB_RDPConfig(uint8_t OB_RDP)
      (+) void FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY)
      (+) void FLASH_OB_BORConfig(uint8_t OB_BOR)
      (+) FLASH_Status FLASH_ProgramOTP(uint32_t Address, uint32_t Data)                                                        
      (+) FLASH_Status FLASH_OB_Launch(void)
      (+) uint32_t FLASH_OB_GetUser(void)                                               
      (+) uint8_t FLASH_OB_GetWRP(void)
      (+) uint8_t FLASH_OB_GetWRP1(void)                                                
      (+) uint8_t FLASH_OB_GetRDP(void)                                                 
      (+) uint8_t FLASH_OB_GetBOR(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
        (++) void FLASH_OB_RDPConfig(uint8_t OB_RDP) => to set the desired read 
             Protection Level
        (++) void FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY) 
             => to configure the user Option Bytes.
        (++) void FLASH_OB_BORConfig(uint8_t OB_BOR) => to set the BOR Level                     

      (#) 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)
 ===============================================================================
                ##### 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 monotoring.
             (++) 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_BOOT1Set 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 758 of file stm32f30x_flash.c.

void FLASH_OB_BORConfig ( uint8_t  OB_BOR)

Sets the BOR Level.

Parameters
OB_BORspecifies the Option Bytes BOR Reset Level. This parameter can be one of the following values:
  • OB_BOR_LEVEL3: Supply voltage ranges from 2.7 to 3.6 V
  • OB_BOR_LEVEL2: Supply voltage ranges from 2.4 to 2.7 V
  • OB_BOR_LEVEL1: Supply voltage ranges from 2.1 to 2.4 V
  • OB_BOR_OFF: Supply voltage ranges from 1.62 to 2.1 V
Return values
None

Definition at line 898 of file stm32f4xx_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_WRPspecifies 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
FLASHStatus: 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
FLASHStatus: 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.

uint8_t FLASH_OB_GetBOR ( void  )

Returns the FLASH BOR level.

Parameters
None
Return values
TheFLASH BOR level:
  • OB_BOR_LEVEL3: Supply voltage ranges from 2.7 to 3.6 V
  • OB_BOR_LEVEL2: Supply voltage ranges from 2.4 to 2.7 V
  • OB_BOR_LEVEL1: Supply voltage ranges from 2.1 to 2.4 V
  • OB_BOR_OFF : Supply voltage ranges from 1.62 to 2.1 V

Definition at line 994 of file stm32f4xx_flash.c.

FlagStatus FLASH_OB_GetRDP ( void  )

Returns the FLASH Read Protection level.

Checks whether the FLASH Read out Protection Status is set or not.

Parameters
None
Return values
FLASHReadOut Protection Status:
  • SET, when OB_RDP_Level_1 or OB_RDP_Level_2 is set
  • RESET, when OB_RDP_Level_0 is set
Parameters
None
Return values
FLASHReadOut Protection Status(SET or RESET)

Definition at line 970 of file stm32f4xx_flash.c.

uint8_t FLASH_OB_GetUser ( void  )

Returns the FLASH User Option Bytes values.

Parameters
None
Return values
TheFLASH User Option Bytes values: IWDG_SW(Bit0), RST_STOP(Bit1) and RST_STDBY(Bit2).
Parameters
None
Return values
TheFLASH User Option Bytes .

Definition at line 934 of file stm32f4xx_flash.c.

uint16_t FLASH_OB_GetWRP ( void  )

Returns the FLASH Write Protection Option Bytes value.

Parameters
None
Return values
TheFLASH Write Protection Option Bytes value

Definition at line 945 of file stm32f4xx_flash.c.

uint16_t FLASH_OB_GetWRP1 ( void  )

Returns the FLASH Write Protection Option Bytes value.

Note
This function can be used only for STM32F427x/437x devices.
Parameters
None
Return values
TheFLASH Write Protection Option Bytes value

Definition at line 957 of file stm32f4xx_flash.c.

FLASH_Status FLASH_OB_Launch ( void  )

Launch the option byte loading.

Parameters
None
Return values
FLASHStatus: The returned value can be: FLASH_BUSY, FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_ERROR_OPERATION or FLASH_COMPLETE.
Parameters
None
Return values
None

Definition at line 915 of file stm32f4xx_flash.c.

void FLASH_OB_Lock ( void  )

Locks the FLASH Option Control Registers access.

Locks the option bytes block access.

Parameters
None
Return values
None

Definition at line 737 of file stm32f4xx_flash.c.

void FLASH_OB_RDPConfig ( uint8_t  OB_RDP)

Sets the read protection level.

Enables or disables the read out protection.

Parameters
OB_RDPspecifies the read protection level. This parameter can be one of the following values:
  • OB_RDP_Level_0: No protection
  • OB_RDP_Level_1: Read protection of the memory
  • OB_RDP_Level_2: Full chip protection
!!!Warning!!! When enabling OB_RDP level 2 it's no more possible to go back to level 1 or 0
Return values
None
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_Levelspecifies 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
FLASHStatus: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 833 of file stm32f4xx_flash.c.

FLASH_Status FLASH_OB_SRAMParityConfig ( uint8_t  OB_SRAM_Parity)

Sets or resets the SRAM partiy.

Parameters
OB_SRAM_ParitySet or Reset the SRAM partiy enable bit. This parameter can be one of the following values:
  • OB_SRAM_PARITY_SET: Set SRAM partiy.
  • OB_SRAM_PARITY_RESET: Reset SRAM partiy.
Return values
None

Definition at line 842 of file stm32f30x_flash.c.

void FLASH_OB_Unlock ( void  )

Unlocks the FLASH Option Control Registers access.

Unlocks the option bytes block access.

Parameters
None
Return values
None

Definition at line 722 of file stm32f4xx_flash.c.

void 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_IWDGSelects 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_STOPReset 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_STDBYReset 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
None
Parameters
OB_IWDGSelects 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_STOPReset 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_STDBYReset 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
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 865 of file stm32f4xx_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_ANALOGSelects 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 800 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_USERSelects 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
FLASHStatus: The returned value can be: FLASH_ERROR_PROGRAM, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 888 of file stm32f30x_flash.c.

void FLASH_OB_WRP1Config ( uint32_t  OB_WRP,
FunctionalState  NewState 
)

Enables or disables the write protection of the desired sectors.

Note
This function can be used only for STM32F427x/437x devices.
When the memory read out protection is selected (RDP level = 1), it is not possible to program or erase the flash sector i if CortexM4 debug features are connected or boot code is executed in RAM, even if nWRPi = 1
Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1).
Parameters
OB_WRPspecifies the sector(s) to be write protected or unprotected. This parameter can be one of the following values:
  • OB_WRP: A value between OB_WRP_Sector12 and OB_WRP_Sector23
  • OB_WRP_Sector_All
Newstatenew state of the Write Protection. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 798 of file stm32f4xx_flash.c.

void FLASH_OB_WRPConfig ( uint32_t  OB_WRP,
FunctionalState  NewState 
)

Enables or disables the write protection of the desired sectors.

Note
When the memory read protection level is selected (RDP level = 1), it is not possible to program or erase the flash sector i if CortexM4 debug features are connected or boot code is executed in RAM, even if nWRPi = 1
Active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1).
Parameters
OB_WRPspecifies the sector(s) to be write protected or unprotected. This parameter can be one of the following values:
  • OB_WRP: A value between OB_WRP_Sector0 and OB_WRP_Sector11
  • OB_WRP_Sector_All
Newstatenew state of the Write Protection. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 759 of file stm32f4xx_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
Addressspecifies the address to be programmed. This parameter can be 0x1FFFF804 or 0x1FFFF806.
Dataspecifies the data to be programmed.
Return values
FLASHStatus: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 932 of file stm32f30x_flash.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:29