# 1   2013-11-07 17:02:29 STM32F1x - Flash Read Out Protection & Write Protection

New member
Registered: 2013-11-07
Posts: 1

STM32F1x - Flash Read Out Protection & Write Protection

Hi all,

The STM32F10x Flash Programming manual states that enabling ROP also enables Write Protection on certain flash pages.

My STM32 does have Read Out Protection enabled.
Im checking the WRP bytes before trying to erase at 0x8000000.
The WRP bytes are set to 0xFFFFFFFF (=no write protection enabled).
When i then try to erase the first page at 0x8000000 the WRPRTERR is set (erase failed due to write protection).

How can the erase fail if the WRP bytes are disabled? Does ROP imply write protection without enabling the appropriate WRP bits?

Flash Programming manual states under "unprotection - case 2" that i can erase the flash option bytes (im using FLASH_EraseOptionBytes()), and then system-reset to remove the write protection.
I have tried this but i still get the WRPRTERR bit set on trying to erase the page at 0x8000000 after the reset. Help on this matter is crucial to getting our product to market quickly.

Any ideas what the problem may be?

Thanks in advance!!



# 2   2013-11-12 09:48:32 STM32F1x - Flash Read Out Protection & Write Protection

Registered: 2007-11-08
Posts: 149

Re: STM32F1x - Flash Read Out Protection & Write Protection


This question would be better answered by ST support. Still, here are my thoughts...

Indeed it is possible that the WRP on the first pages which is implied by the ROP does not appear in the WRP values. That's in fact what I would expect. But that should be checked with ST support.

When ROP is enabled, the only change you can make to the Flash is Mass Erase. However, you should be able to make your application disable ROP temporarily. (there are the non-volatile Option bytes and the currently active active ones, initialized at reset from the NVM, and which the application can modify easily) Check the bootloader examples from ST for how to do that.

On some devices it might also be needed to execute the erase from the RAM. Again, check the bootloader examples from ST, and the ST forum.

Best Regards,




Board footer