2009-08-02 11:07 AM
Flash read-protection question
2011-05-17 04:19 AM
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 ) ''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?2011-05-17 04:19 AM
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!!!