cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429: Can Flash Sector "write protection" be set and temporarily cleared during operation (to erase or write some data)?

hpipon957
Associate III

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.

  1. How long does it actually take to set a new protection value?
  2. Does each change also cause flash wear and so would have a limitation if performed very frequently?
  3. 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

5 REPLIES 5
hpipon957
Associate III

Hi All

I have published the following video discussing and demonstrating STM32F429 (similar or the same for various other parts too) Flash Option programming and operation, focusing on Flash Sector Write protection and the Flash Read-out protection - a very important aspect in many products: https://youtu.be/IN_U7QsYQlc

Regards

Mark

Ede S
Associate III

Hello,

Did you find an answer to this question :

2. Does each change also cause flash wear and so would have a limitation if performed very frequently?

Your video does not answer this question, and I am interested in it !

hpipon957
Associate III

Hi

Yes, I managed to answer all questions with a few days of intensive research, but i was told that I was not welcome to show my work on the forum and so I do not contribure any more.

Thank you for your understanding.

Regards

Mark

Ede S
Associate III

Argh it is sad !

I understand.

I was interested in your work results, I cannot find informations about the option byte updating consequences, I presume it i not good for flash cycles. That is strange that nobody else asks the question...

It misses the capability to change access rights on the fly, without modifying flash data (I also presume there is nothing, as nothing about that is in reference manual...). In my case, I will give permanent write access for this reason.

Ede S
Associate III

Thank you for your answer, whatever !