FLASH_Private_Functions
[FLASH]

Functions

void FLASH_ClearFlag (uint32_t FLASH_FLAG)
 Clears the FLASH’s pending flags.
FLASH_Status FLASH_EnableWriteProtection (uint32_t FLASH_Pages)
 Write protects the desired pages.
FLASH_Status FLASH_EraseAllBank1Pages (void)
 Erases all Bank1 FLASH pages.
FLASH_Status FLASH_EraseAllPages (void)
 Erases all FLASH pages.
FLASH_Status FLASH_EraseOptionBytes (void)
 Erases the FLASH option bytes.
FLASH_Status FLASH_ErasePage (uint32_t Page_Address)
 Erases a specified FLASH page.
FLASH_Status FLASH_GetBank1Status (void)
 Returns the FLASH Bank1 Status.
FlagStatus FLASH_GetFlagStatus (uint32_t FLASH_FLAG)
 Checks whether the specified FLASH flag is set or not.
FlagStatus FLASH_GetPrefetchBufferStatus (void)
 Checks whether the FLASH Prefetch Buffer status is set or not.
FlagStatus FLASH_GetReadOutProtectionStatus (void)
 Checks whether the FLASH Read Out Protection Status is set or not.
FLASH_Status FLASH_GetStatus (void)
 Returns the FLASH Status.
uint32_t FLASH_GetUserOptionByte (void)
 Returns the FLASH User Option Bytes values.
uint32_t FLASH_GetWriteProtectionOptionByte (void)
 Returns the FLASH Write Protection Option Bytes Register value.
void FLASH_HalfCycleAccessCmd (uint32_t FLASH_HalfCycleAccess)
 Enables or disables the Half cycle flash access.
void FLASH_ITConfig (uint32_t FLASH_IT, FunctionalState NewState)
 Enables or disables the specified FLASH interrupts.
void FLASH_Lock (void)
 Locks the FLASH Program Erase Controller.
void FLASH_LockBank1 (void)
 Locks the FLASH Bank1 Program Erase Controller.
void FLASH_PrefetchBufferCmd (uint32_t FLASH_PrefetchBuffer)
 Enables or disables the Prefetch Buffer.
FLASH_Status FLASH_ProgramHalfWord (uint32_t Address, uint16_t Data)
 Programs a half word at a specified address.
FLASH_Status FLASH_ProgramOptionByteData (uint32_t Address, uint8_t Data)
 Programs a half word at a specified Option Byte Data address.
FLASH_Status FLASH_ProgramWord (uint32_t Address, uint32_t Data)
 Programs a word at a specified address.
FLASH_Status FLASH_ReadOutProtection (FunctionalState NewState)
 Enables or disables the read out protection.
void FLASH_SetLatency (uint32_t FLASH_Latency)
 Sets the code latency value.
void FLASH_Unlock (void)
 Unlocks the FLASH Program Erase Controller.
void FLASH_UnlockBank1 (void)
 Unlocks the FLASH Bank1 Program Erase Controller.
FLASH_Status FLASH_UserOptionByteConfig (uint16_t OB_IWDG, uint16_t OB_STOP, uint16_t OB_STDBY)
 Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
FLASH_Status FLASH_WaitForLastBank1Operation (uint32_t Timeout)
 Waits for a Flash operation on Bank1 to complete or a TIMEOUT to occur.
FLASH_Status FLASH_WaitForLastOperation (uint32_t Timeout)
 Waits for a Flash operation to complete or a TIMEOUT to occur.

Function Documentation

void FLASH_ClearFlag ( uint32_t  FLASH_FLAG  ) 

Clears the FLASH’s pending flags.

Note:
This function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices, this function clears Bank1 or Bank2’s pending flags
  • For other devices, it clears Bank1’s pending flags.
Parameters:
FLASH_FLAG,: specifies the FLASH flags to clear. This parameter can be any combination of the following values:

  • FLASH_FLAG_PGERR: FLASH Program error flag
  • FLASH_FLAG_WRPRTERR: FLASH Write protected error flag
  • FLASH_FLAG_EOP: FLASH End of Operation flag
Return values:
None 

Definition at line 1442 of file stm32f10x_flash.c.

References assert_param, FLASH, and IS_FLASH_CLEAR_FLAG.

Referenced by main().

FLASH_Status FLASH_EnableWriteProtection ( uint32_t  FLASH_Pages  ) 

Write protects the desired pages.

Note:
This function can be used for all STM32F10x devices.
Parameters:
FLASH_Pages,: specifies the address of the pages to be write protected. This parameter can be:

  • For STM32_Low-density_devices: value between FLASH_WRProt_Pages0to3 and FLASH_WRProt_Pages28to31
  • For STM32_Medium-density_devices: value between FLASH_WRProt_Pages0to3 and FLASH_WRProt_Pages124to127
  • For STM32_High-density_devices: value between FLASH_WRProt_Pages0to1 and FLASH_WRProt_Pages60to61 or FLASH_WRProt_Pages62to255
  • For STM32_Connectivity_line_devices: value between FLASH_WRProt_Pages0to1 and FLASH_WRProt_Pages60to61 or FLASH_WRProt_Pages62to127
  • For STM32_XL-density_devices: value between FLASH_WRProt_Pages0to1 and FLASH_WRProt_Pages60to61 or FLASH_WRProt_Pages62to511
  • FLASH_WRProt_AllPages
Return values:
FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 974 of file stm32f10x_flash.c.

References assert_param, CR_OPTPG_Reset, CR_OPTPG_Set, FLASH, FLASH_COMPLETE, FLASH_KEY1, FLASH_KEY2, FLASH_TIMEOUT, FLASH_WaitForLastOperation(), IS_FLASH_WRPROT_PAGE, OB, ProgramTimeout, WRP0_Mask, WRP1_Mask, WRP2_Mask, and WRP3_Mask.

Referenced by main().

FLASH_Status FLASH_EraseAllBank1Pages ( void   ) 

Erases all Bank1 FLASH pages.

Note:
This function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices this function erases all Bank1 pages.
  • For all other devices it erases all Bank1 pages and it is equivalent to FLASH_EraseAllPages function.
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 554 of file stm32f10x_flash.c.

References CR_MER_Reset, CR_MER_Set, CR_STRT_Set, EraseTimeout, FLASH, FLASH_COMPLETE, FLASH_WaitForLastBank1Operation(), and status.

FLASH_Status FLASH_EraseAllPages ( void   ) 

Erases all FLASH pages.

Note:
This function can be used for all STM32F10x devices.
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 491 of file stm32f10x_flash.c.

References CR_MER_Reset, CR_MER_Set, CR_STRT_Set, EraseTimeout, FLASH, FLASH_COMPLETE, FLASH_WaitForLastBank1Operation(), FLASH_WaitForLastOperation(), and status.

FLASH_Status FLASH_EraseOptionBytes ( void   ) 

Erases the FLASH option bytes.

Note:
This functions erases all option bytes except the Read protection (RDP).
This function can be used for all STM32F10x devices.
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 615 of file stm32f10x_flash.c.

References CR_OPTER_Reset, CR_OPTER_Set, CR_OPTPG_Reset, CR_OPTPG_Set, CR_STRT_Set, EraseTimeout, FLASH, FLASH_COMPLETE, FLASH_GetReadOutProtectionStatus(), FLASH_KEY1, FLASH_KEY2, FLASH_TIMEOUT, FLASH_WaitForLastOperation(), OB, ProgramTimeout, RDP_Key, and RESET.

Referenced by main().

FLASH_Status FLASH_ErasePage ( uint32_t  Page_Address  ) 

Erases a specified FLASH page.

Note:
This function can be used for all STM32F10x devices.
Parameters:
Page_Address,: The page address to be erased.
Return values:
FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 418 of file stm32f10x_flash.c.

References assert_param, CR_PER_Reset, CR_PER_Set, CR_STRT_Set, EraseTimeout, FLASH, FLASH_BANK1_END_ADDRESS, FLASH_COMPLETE, FLASH_WaitForLastBank1Operation(), FLASH_WaitForLastOperation(), IS_FLASH_ADDRESS, and status.

Referenced by main().

FLASH_Status FLASH_GetBank1Status ( void   ) 

Returns the FLASH Bank1 Status.

Note:
This function can be used for all STM32F10x devices, it is equivalent to FLASH_GetStatus function.
Parameters:
None 
Return values:
FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG, FLASH_ERROR_WRP or FLASH_COMPLETE

Definition at line 1514 of file stm32f10x_flash.c.

References FLASH, FLASH_BUSY, FLASH_COMPLETE, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_FLAG_BANK1_BSY, FLASH_FLAG_BANK1_PGERR, FLASH_FLAG_BANK1_WRPRTERR, and FLASH_FLAG_BSY.

Referenced by FLASH_WaitForLastBank1Operation(), and FLASH_WaitForLastOperation().

FlagStatus FLASH_GetFlagStatus ( uint32_t  FLASH_FLAG  ) 

Checks whether the specified FLASH flag is set or not.

Note:
This function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices, this function checks whether the specified Bank1 or Bank2 flag is set or not.
  • For other devices, it checks whether the specified Bank1 flag is set or not.
Parameters:
FLASH_FLAG,: specifies the FLASH flag to check. This parameter can be one of the following values:

  • FLASH_FLAG_BSY: FLASH Busy flag
  • FLASH_FLAG_PGERR: FLASH Program error flag
  • FLASH_FLAG_WRPRTERR: FLASH Write protected error flag
  • FLASH_FLAG_EOP: FLASH End of Operation flag
  • FLASH_FLAG_OPTERR: FLASH Option Byte error flag
Return values:
The new state of FLASH_FLAG (SET or RESET).

Definition at line 1356 of file stm32f10x_flash.c.

References assert_param, FLASH, FLASH_FLAG_OPTERR, IS_FLASH_GET_FLAG, RESET, and SET.

FlagStatus FLASH_GetPrefetchBufferStatus ( void   ) 

Checks whether the FLASH Prefetch Buffer status is set or not.

Note:
This function can be used for all STM32F10x devices.
Parameters:
None 
Return values:
FLASH Prefetch Buffer Status (SET or RESET).

Definition at line 1259 of file stm32f10x_flash.c.

References ACR_PRFTBS_Mask, FLASH, RESET, and SET.

FlagStatus FLASH_GetReadOutProtectionStatus ( void   ) 

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

Note:
This function can be used for all STM32F10x devices.
Parameters:
None 
Return values:
FLASH ReadOut Protection Status(SET or RESET)

Definition at line 1239 of file stm32f10x_flash.c.

References FLASH, RDPRT_Mask, RESET, and SET.

Referenced by FLASH_EraseOptionBytes().

FLASH_Status FLASH_GetStatus ( void   ) 

Returns the FLASH Status.

Note:
This function can be used for all STM32F10x devices, it is equivalent to FLASH_GetBank1Status function.
Parameters:
None 
Return values:
FLASH Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG, FLASH_ERROR_WRP or FLASH_COMPLETE

Definition at line 1476 of file stm32f10x_flash.c.

References FLASH, FLASH_BUSY, FLASH_COMPLETE, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_FLAG_BSY, FLASH_FLAG_PGERR, and FLASH_FLAG_WRPRTERR.

uint32_t FLASH_GetUserOptionByte ( void   ) 

Returns the FLASH User Option Bytes values.

Note:
This function can be used for all STM32F10x devices.
Parameters:
None 
Return values:
The FLASH User Option Bytes values:IWDG_SW(Bit0), RST_STOP(Bit1) and RST_STDBY(Bit2).

Definition at line 1215 of file stm32f10x_flash.c.

References FLASH.

uint32_t FLASH_GetWriteProtectionOptionByte ( void   ) 

Returns the FLASH Write Protection Option Bytes Register value.

Note:
This function can be used for all STM32F10x devices.
Parameters:
None 
Return values:
The FLASH Write Protection Option Bytes Register value

Definition at line 1227 of file stm32f10x_flash.c.

References FLASH.

Referenced by main().

void FLASH_HalfCycleAccessCmd ( uint32_t  FLASH_HalfCycleAccess  ) 

Enables or disables the Half cycle flash access.

Note:
This function can be used for all STM32F10x devices.
Parameters:
FLASH_HalfCycleAccess,: specifies the FLASH Half cycle Access mode. This parameter can be one of the following values:

  • FLASH_HalfCycleAccess_Enable: FLASH Half Cycle Enable
  • FLASH_HalfCycleAccess_Disable: FLASH Half Cycle Disable
Return values:
None 

Definition at line 280 of file stm32f10x_flash.c.

References ACR_HLFCYA_Mask, assert_param, FLASH, and IS_FLASH_HALFCYCLEACCESS_STATE.

void FLASH_ITConfig ( uint32_t  FLASH_IT,
FunctionalState  NewState 
)

Enables or disables the specified FLASH interrupts.

Note:
This function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices, enables or disables the specified FLASH interrupts for Bank1 and Bank2.
  • For other devices it enables or disables the specified FLASH interrupts for Bank1.
Parameters:
FLASH_IT,: specifies the FLASH interrupt sources to be enabled or disabled. This parameter can be any combination of the following values:

  • FLASH_IT_ERROR: FLASH Error Interrupt
  • FLASH_IT_EOP: FLASH end of operation Interrupt
NewState,: new state of the specified Flash interrupts. This parameter can be: ENABLE or DISABLE.
Return values:
None 

Definition at line 1289 of file stm32f10x_flash.c.

References assert_param, DISABLE, FLASH, IS_FLASH_IT, and IS_FUNCTIONAL_STATE.

void FLASH_Lock ( void   ) 

Locks the FLASH Program Erase Controller.

Note:
This function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices this function Locks Bank1 and Bank2.
  • For all other devices it Locks Bank1 and it is equivalent to FLASH_LockBank1 function.
Parameters:
None 
Return values:
None 

Definition at line 371 of file stm32f10x_flash.c.

References CR_LOCK_Set, and FLASH.

Referenced by main().

void FLASH_LockBank1 ( void   ) 

Locks the FLASH Bank1 Program Erase Controller.

Note:
this function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices this function Locks Bank1.
  • For all other devices it Locks Bank1 and it is equivalent to FLASH_Lock function.
Parameters:
None 
Return values:
None 

Definition at line 391 of file stm32f10x_flash.c.

References CR_LOCK_Set, and FLASH.

Referenced by main().

void FLASH_PrefetchBufferCmd ( uint32_t  FLASH_PrefetchBuffer  ) 

Enables or disables the Prefetch Buffer.

Note:
This function can be used for all STM32F10x devices.
Parameters:
FLASH_PrefetchBuffer,: specifies the Prefetch buffer status. This parameter can be one of the following values:

  • FLASH_PrefetchBuffer_Enable: FLASH Prefetch Buffer Enable
  • FLASH_PrefetchBuffer_Disable: FLASH Prefetch Buffer Disable
Return values:
None 

Definition at line 299 of file stm32f10x_flash.c.

References ACR_PRFTBE_Mask, assert_param, FLASH, and IS_FLASH_PREFETCHBUFFER_STATE.

Referenced by RCC_Configuration(), SetSysClockTo24(), SetSysClockTo36(), SetSysClockTo48(), SetSysClockTo56(), SetSysClockTo72(), and SetSysClockToHSE().

FLASH_Status FLASH_ProgramHalfWord ( uint32_t  Address,
uint16_t  Data 
)

Programs a half word at a specified address.

Note:
This function can be used for all STM32F10x devices.
Parameters:
Address,: specifies the address to be programmed.
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 857 of file stm32f10x_flash.c.

References assert_param, CR_PG_Reset, CR_PG_Set, FLASH, FLASH_BANK1_END_ADDRESS, FLASH_COMPLETE, FLASH_WaitForLastBank1Operation(), FLASH_WaitForLastOperation(), IS_FLASH_ADDRESS, and ProgramTimeout.

Referenced by main().

FLASH_Status FLASH_ProgramOptionByteData ( uint32_t  Address,
uint8_t  Data 
)

Programs a half word at a specified Option Byte Data address.

Note:
This function can be used for all STM32F10x devices.
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 928 of file stm32f10x_flash.c.

References assert_param, CR_OPTPG_Reset, CR_OPTPG_Set, FLASH, FLASH_COMPLETE, FLASH_KEY1, FLASH_KEY2, FLASH_TIMEOUT, FLASH_WaitForLastOperation(), IS_OB_DATA_ADDRESS, and ProgramTimeout.

FLASH_Status FLASH_ProgramWord ( uint32_t  Address,
uint32_t  Data 
)

Programs a word at a specified address.

Note:
This function can be used for all STM32F10x devices.
Parameters:
Address,: specifies the address to be programmed.
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 680 of file stm32f10x_flash.c.

References assert_param, CR_PG_Reset, CR_PG_Set, FLASH, FLASH_BANK1_END_ADDRESS, FLASH_COMPLETE, FLASH_WaitForLastBank1Operation(), FLASH_WaitForLastOperation(), IS_FLASH_ADDRESS, and ProgramTimeout.

Referenced by main().

FLASH_Status FLASH_ReadOutProtection ( FunctionalState  NewState  ) 

Enables or disables the read out protection.

Note:
If the user has already programmed the other option bytes before calling this function, he must re-program them since this function erases all option bytes.
This function can be used for all STM32F10x devices.
Parameters:
Newstate,: new state of the ReadOut Protection. This parameter can be: ENABLE or DISABLE.
Return values:
FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 1048 of file stm32f10x_flash.c.

References assert_param, CR_OPTER_Reset, CR_OPTER_Set, CR_OPTPG_Reset, CR_OPTPG_Set, CR_STRT_Set, DISABLE, EraseTimeout, FLASH, FLASH_COMPLETE, FLASH_KEY1, FLASH_KEY2, FLASH_TIMEOUT, FLASH_WaitForLastOperation(), IS_FUNCTIONAL_STATE, OB, and RDP_Key.

void FLASH_SetLatency ( uint32_t  FLASH_Latency  ) 

Sets the code latency value.

 This driver provides functions to configure and program the Flash memory of all STM32F10x devices,
 including the latest STM32F10x_XL density devices. 

 STM32F10x_XL devices feature up to 1 Mbyte with dual bank architecture for read-while-write (RWW) capability:
    - bank1: fixed size of 512 Kbytes (256 pages of 2Kbytes each)
    - bank2: up to 512 Kbytes (up to 256 pages of 2Kbytes each)
 While other STM32F10x devices features only one bank with memory up to 512 Kbytes.

 In version V3.3.0, some functions were updated and new ones were added to support
 STM32F10x_XL devices. Thus some functions manages all devices, while other are 
 dedicated for XL devices only.
 
 The table below presents the list of available functions depending on the used STM32F10x devices.  
      

 Legacy functions used for all STM32F10x devices *

   +----------------------------------------------------------------------------------------------------------------------------------+
   |       Functions prototypes         |STM32F10x_XL|Other STM32F10x|    Comments                                                    |
   |                                    |   devices  |  devices      |                                                                |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_SetLatency                    |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_HalfCycleAccessCmd            |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_PrefetchBufferCmd             |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_Unlock                        |    Yes     |      Yes      | - For STM32F10X_XL devices: unlock Bank1 and Bank2.            |
   |                                    |            |               | - For other devices: unlock Bank1 and it is equivalent         |
   |                                    |            |               |   to FLASH_UnlockBank1 function.                               |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_Lock                          |    Yes     |      Yes      | - For STM32F10X_XL devices: lock Bank1 and Bank2.              |
   |                                    |            |               | - For other devices: lock Bank1 and it is equivalent           |
   |                                    |            |               |   to FLASH_LockBank1 function.                                 |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_ErasePage                     |    Yes     |      Yes      | - For STM32F10x_XL devices: erase a page in Bank1 and Bank2    |
   |                                    |            |               | - For other devices: erase a page in Bank1                     |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_EraseAllPages                 |    Yes     |      Yes      | - For STM32F10x_XL devices: erase all pages in Bank1 and Bank2 |
   |                                    |            |               | - For other devices: erase all pages in Bank1                  |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_EraseOptionBytes              |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_ProgramWord                   |    Yes     |      Yes      | Updated to program up to 1MByte (depending on the used device) |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_ProgramHalfWord               |    Yes     |      Yes      | Updated to program up to 1MByte (depending on the used device) |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_ProgramOptionByteData         |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_EnableWriteProtection         |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_ReadOutProtection             |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_UserOptionByteConfig          |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_GetUserOptionByte             |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_GetWriteProtectionOptionByte  |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_GetReadOutProtectionStatus    |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_GetPrefetchBufferStatus       |    Yes     |      Yes      | No change                                                      |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_ITConfig                      |    Yes     |      Yes      | - For STM32F10x_XL devices: enable Bank1 and Bank2's interrupts|
   |                                    |            |               | - For other devices: enable Bank1's interrupts                 |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_GetFlagStatus                 |    Yes     |      Yes      | - For STM32F10x_XL devices: return Bank1 and Bank2's flag status|
   |                                    |            |               | - For other devices: return Bank1's flag status                |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_ClearFlag                     |    Yes     |      Yes      | - For STM32F10x_XL devices: clear Bank1 and Bank2's flag       |
   |                                    |            |               | - For other devices: clear Bank1's flag                        |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_GetStatus                     |    Yes     |      Yes      | - Return the status of Bank1 (for all devices)                 |
   |                                    |            |               |   equivalent to FLASH_GetBank1Status function                  |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_WaitForLastOperation          |    Yes     |      Yes      | - Wait for Bank1 last operation (for all devices)              |
   |                                    |            |               |   equivalent to: FLASH_WaitForLastBank1Operation function      |
   +----------------------------------------------------------------------------------------------------------------------------------+


 New functions used for all STM32F10x devices to manage Bank1:                                                        *
   - These functions are mainly useful for STM32F10x_XL density devices, to have separate control for Bank1 and bank2 *
   - For other devices, these functions are optional (covered by functions listed above)                              *

   +----------------------------------------------------------------------------------------------------------------------------------+
   |       Functions prototypes         |STM32F10x_XL|Other STM32F10x|    Comments                                                    |
   |                                    |   devices  |  devices      |                                                                |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_UnlockBank1                  |    Yes     |      Yes      | - Unlock Bank1                                                 |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_LockBank1                     |    Yes     |      Yes      | - Lock Bank1                                                   |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_EraseAllBank1Pages           |    Yes     |      Yes      | - Erase all pages in Bank1                                     |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_GetBank1Status               |    Yes     |      Yes      | - Return the status of Bank1                                   |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_WaitForLastBank1Operation    |    Yes     |      Yes      | - Wait for Bank1 last operation                                |
   +----------------------------------------------------------------------------------------------------------------------------------+


 New Functions used only with STM32F10x_XL density devices to manage Bank2 *

   +----------------------------------------------------------------------------------------------------------------------------------+
   |       Functions prototypes         |STM32F10x_XL|Other STM32F10x|    Comments                                                    |
   |                                    |   devices  |  devices      |                                                                |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_UnlockBank2                  |    Yes     |      No       | - Unlock Bank2                                                 |
   |----------------------------------------------------------------------------------------------------------------------------------|
   |FLASH_LockBank2                     |    Yes     |      No       | - Lock Bank2                                                   |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_EraseAllBank2Pages           |    Yes     |      No       | - Erase all pages in Bank2                                     |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_GetBank2Status               |    Yes     |      No       | - Return the status of Bank2                                   |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_WaitForLastBank2Operation    |    Yes     |      No       | - Wait for Bank2 last operation                                |
   |----------------------------------------------------------------------------------------------------------------------------------|
   | FLASH_BootConfig                   |    Yes     |      No       | - Configure to boot from Bank1 or Bank2                        |
   +----------------------------------------------------------------------------------------------------------------------------------+
Note:
This function can be used for all STM32F10x devices.
Parameters:
FLASH_Latency,: specifies the FLASH Latency value. This parameter can be one of the following values:

  • FLASH_Latency_0: FLASH Zero Latency cycle
  • FLASH_Latency_1: FLASH One Latency cycle
  • FLASH_Latency_2: FLASH Two Latency cycles
Return values:
None 

Definition at line 253 of file stm32f10x_flash.c.

References ACR_LATENCY_Mask, assert_param, FLASH, and IS_FLASH_LATENCY.

Referenced by RCC_Configuration(), SetSysClockTo24(), SetSysClockTo36(), SetSysClockTo48(), SetSysClockTo56(), SetSysClockTo72(), and SetSysClockToHSE().

void FLASH_Unlock ( void   ) 

Unlocks the FLASH Program Erase Controller.

Note:
This function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices this function unlocks Bank1 and Bank2.
  • For all other devices it unlocks Bank1 and it is equivalent to FLASH_UnlockBank1 function..
Parameters:
None 
Return values:
None 

Definition at line 318 of file stm32f10x_flash.c.

References FLASH, FLASH_KEY1, and FLASH_KEY2.

Referenced by main().

void FLASH_UnlockBank1 ( void   ) 

Unlocks the FLASH Bank1 Program Erase Controller.

Note:
This function can be used for all STM32F10x devices.
  • For STM32F10X_XL devices this function unlocks Bank1.
  • For all other devices it unlocks Bank1 and it is equivalent to FLASH_Unlock function.
Parameters:
None 
Return values:
None 

Definition at line 339 of file stm32f10x_flash.c.

References FLASH, FLASH_KEY1, and FLASH_KEY2.

Referenced by main().

FLASH_Status FLASH_UserOptionByteConfig ( uint16_t  OB_IWDG,
uint16_t  OB_STOP,
uint16_t  OB_STDBY 
)

Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.

Note:
This function can be used for all STM32F10x devices.
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 1117 of file stm32f10x_flash.c.

References assert_param, CR_OPTPG_Reset, CR_OPTPG_Set, FLASH, FLASH_COMPLETE, FLASH_KEY1, FLASH_KEY2, FLASH_TIMEOUT, FLASH_WaitForLastOperation(), IS_OB_IWDG_SOURCE, IS_OB_STDBY_SOURCE, IS_OB_STOP_SOURCE, OB, and ProgramTimeout.

FLASH_Status FLASH_WaitForLastBank1Operation ( uint32_t  Timeout  ) 

Waits for a Flash operation on Bank1 to complete or a TIMEOUT to occur.

Note:
This function can be used for all STM32F10x devices, it is equivalent to FLASH_WaitForLastOperation.
Parameters:
Timeout,: FLASH progamming Timeout
Return values:
FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 1622 of file stm32f10x_flash.c.

References FLASH_COMPLETE, FLASH_FLAG_BANK1_BSY, FLASH_GetBank1Status(), and FLASH_TIMEOUT.

Referenced by FLASH_EraseAllBank1Pages(), FLASH_EraseAllPages(), FLASH_ErasePage(), FLASH_ProgramHalfWord(), and FLASH_ProgramWord().

FLASH_Status FLASH_WaitForLastOperation ( uint32_t  Timeout  ) 

Waits for a Flash operation to complete or a TIMEOUT to occur.

Note:
This function can be used for all STM32F10x devices, it is equivalent to FLASH_WaitForLastBank1Operation.
  • For STM32F10X_XL devices this function waits for a Bank1 Flash operation to complete or a TIMEOUT to occur.
  • For all other devices it waits for a Flash operation to complete or a TIMEOUT to occur.
Parameters:
Timeout,: FLASH progamming Timeout
Return values:
FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

Definition at line 1594 of file stm32f10x_flash.c.

References FLASH_BUSY, FLASH_COMPLETE, FLASH_GetBank1Status(), and FLASH_TIMEOUT.

Referenced by FLASH_EnableWriteProtection(), FLASH_EraseAllPages(), FLASH_EraseOptionBytes(), FLASH_ErasePage(), FLASH_ProgramHalfWord(), FLASH_ProgramOptionByteData(), FLASH_ProgramWord(), FLASH_ReadOutProtection(), and FLASH_UserOptionByteConfig().

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32