cancel
Showing results for 
Search instead for 
Did you mean: 

Flash read-protection question

swhite
Associate III
Posted on August 02, 2009 at 20:07

Flash read-protection question

2 REPLIES 2
swhite
Associate III
Posted on May 17, 2011 at 13:19

In my application I want to change some of the option bytes, stored in flash, on the fly. However to do that all other option bytes need to be erased first since they can't be erased individually.

(All references to

http://www.st.com/stonline/products/literature/pm/13259.pdf

)

''FPEC preliminarily reads the value of the addressed option byte and checks that it has been erased. If not, the program operation is skipped and a warning is issued by the WRPRTERR bit in the FLASH_SR register.''

--page 17

However erasing the option bytes includes the read-protection (RDP). And

''The erased state of the read protection option byte protects the Flash memory.''

--page 18

which implies that performing the erase operation, by itself, enables read-protection.

My question is: is that true WITHOUT an intervening reset to change the RDPRT bit in the FLASH_OPT register?

To put it another way, is it safe to erase/reprogram the read-protection option byte IF its new value is the same as that before erasure?

swhite
Associate III
Posted on May 17, 2011 at 13:19

Ok, the Flash programming manual is incorrect or I'm missing something.

(Using same reference as above)

According to table 5 on page 19 the ''Read protection status'' is ''Protected'' when the RDP byes are erased (matches my quote in the above post).

However I just ran a program, from RAM, and erased the option bytes and the read protection seems disabled (as does the write which I'd previously enabled).

Also, table 5 shows the ''Read protection status'' as ''Not protected'' when the option byte is set to RDPRT???

It appears to me as though the manual has it backwards!!!