Embedded Flash memory interface
Table 12.
Bit 15:12
nWRP: Flash memory write protection option bytes.
Sectors 12 to 23 can be write protected.
Bits 11: 0
3.6.2
Programming user option bytes
To run any operation on this sector, the option lock bit (OPTLOCK) in the Flash option
control register (FLASH_OPTCR) must be cleared. To be allowed to clear this bit, you have
to perform the following sequence:
1.
Write OPTKEY1 = 0x0819 2A3B in the Flash option key register (FLASH_OPTKEYR)
2.
Write OPTKEY2 = 0x4C5D 6E7F in the Flash option key register (FLASH_OPTKEYR)
The user option bytes can be protected against unwanted erase/program operations by
setting the OPTLOCK bit by software.
Modifying user option bytes on STM32F405xx/07xx and STM32F415xx/17xx
To modify the user option value, follow the sequence below:
1.
Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register
2.
Write the desired option value in the FLASH_OPTCR register.
3.
Set the option start bit (OPTSTRT) in the FLASH_OPTCR register
4.
Wait for the BSY bit to be cleared.
Note:
The value of an option is automatically modified by first erasing the user configuration sector
and then programming all the option bytes with the values contained in the FLASH_OPTCR
register.
Modifying user option bytes on STM32F42xxx and STM32F43xxx
To modify the user option byte value, follow the sequence below:
1.
Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register
2.
Write the option byte value in the FLASH_OPTCR and/or FLASH_OPTCR1 register.
3.
Set the option start bit (OPTSTRT) in the FLASH_OPTCR register
4.
Wait for the BSY bit to be cleared
Note:
The value of an option byte is automatically modified by first erasing the user configuration
sector and then programming all the option bytes with the values contained in the
FLASH_OPTCR and FLASH_OPTCR1 registers.
71/1422
Description of the option bytes (STM32F42xxx and STM32F43xxx)
Option bytes (word, address 0x1FFE C008)
0xF: not used
nWRPi:
0: Write protection active on sector i.
1: Write protection not active on sector i.
Doc ID 018909 Rev 4
RM0090
Need help?
Do you have a question about the STM32F40 Series and is the answer not in the manual?