STM32F429: Can Flash Sector "write protection" be set and temporarily cleared during operation (to erase or write some data)?
Hi All
I have been experimenting with the Flash write protection most of the day and was hoping to be able to set it by just writing the setting in the FLASH_OPTCR register, however the value that is written doesn't seem to affect anything unless committed to Flash (with the OPTSTRT flag).
The idea was to generally have all sectors protected from writes/erases and to enable just the sector each time a write or erase is performed to it - then protect it again.
Based on the results it looks like each time something is changed the change needs to be committed to flash as well before it takes effect. Since there are a lot of write/erase operations this sounds as though it may be unsuitable, but I don't find any information about its impact.
- How long does it actually take to set a new protection value?
- Does each change also cause flash wear and so would have a limitation if performed very frequently?
- Is there another reliable method of using flash protection that can be generally on, but quickly removed temporarily when the application wants to do an operation on it?
Note that I was using the Flash_CR lock to do this generally but am looking for a second level of protection to further reduce the possibility that flash content could be modified by run-away code.
Presently I have a bricked board after setting a value I didn't want in the FLASH_OPTCR register (I have posted a different question about this) so am generally stuck at the moment (and can't do the timing measurement in point 1 above, for example) but it would still be nice to know whether there is any sense in experimenting with write protection or not. [Also the debugger can't load code when it is on, which makes life complicated...]
Thanks
Mark
