Flash program memory and data EEPROM (FLASH) RM0367
118/1043 RM0367 Rev 7
3.7.9 Write protection register 1 (FLASH_WRPROT1)
Address offset: 0x20
Reset value: 0xXXXX XXXX. It depends on the value programmed in the option bytes.
During production, it is set to 0x0000 0000.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
WRPROT1[31:16]
rrrrrrr rrrrrrrr r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WRPROT1[15:0]
rrrrrrr rrrrrrrr r
Bits 31:0 WRPROT1: Write protection
– If WPRMOD = 0 in the FLASH_OPTR register, these bits contain the write protection
configuration for the Flash memory (every bit protects a 4-Kbyte sector: the first bit protects
the first sector, the second bit protects the second page and so on). In this case, 1 = sector
protected, 0 = no protection.
– If WPRMOD = 1, these bits are used to protect from reading as data (see Read as data and
pre-read), and then also from writing, with the same granularity and with the same
combination of bits and sectors. The read protection does not protect against a fetch. In this
case, 1 = no protection, 0 = sector protected.
When WPRMOD = 0, it is possible to set or reset these bits without any limitation changing
the relative Option bytes.
When WPRMOD = 1, it is only possible to increase the protection, which means that the user
can add zeros but cannot add ones.
The mass erase deletes the WPRMOD bits but does not delete the content of this register.
After a mass erase, the user must write the relative Option bytes with zeros to remove
completely the write protections.
If there is a mismatch on this configuration during the Option bytes loading, and the content of
WPRMOD in the FLASH_OPTR register is:
1, this configuration is loaded with 0x0000.
0, this configuration is loaded with 0xFFFF.
If there was a mismatch when WPRMOD was loaded in the FLASH_OPTR register (thus
loaded with ones), the register is loaded with 0x0000.