cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429: The FLASH_OPTCR register has been set to 0xcfffaaed and nothing is working - how can the 0xc at the start be cleared to recover the board?

hpipon957
Associate III

Hi All

I have been experimenting with setting flash sector write protection but found that when I did I could no longer program with the debugger. I managed to reset the options by writing the unlock sequence via the debugger (that can still connect) but after doing it a few times I made a typo and have now have the OPTCR register set to 0xcfffaaed (or 0xcfffaaec when I remove the lock). I can't get rid of the 0xc at the start (when I try the FLASH_SR bit 0x10 is set) and in this state nothing is working.

Can the board be recovered?

Thanks

Mark

1 ACCEPTED SOLUTION

Accepted Solutions

From RM0090 rev.17, 3.7.5 Proprietary code readout protection (PCROP):

The deactivation of the SPRMOD and/or the unprotection of PCROPed user sectors can

only occur when, at the same time, the RDP level changes from 1 to 0. If this condition is not

respected, the user option byte modification is cancelled and the write error WRPERR flag

is set.

i.e. you first have to change the RDP bits to something else than 0xAA or 0xCC.

JW

View solution in original post

2 REPLIES 2

From RM0090 rev.17, 3.7.5 Proprietary code readout protection (PCROP):

The deactivation of the SPRMOD and/or the unprotection of PCROPed user sectors can

only occur when, at the same time, the RDP level changes from 1 to 0. If this condition is not

respected, the user option byte modification is cancelled and the write error WRPERR flag

is set.

i.e. you first have to change the RDP bits to something else than 0xAA or 0xCC.

JW

hpipon957
Associate III

Brilliant - that was it. Now the board is back in action!

Unfortunately I think that I will have to abandon tests with switching protection bits off and on on the fly because it keeps falling into this mode after a few (fast) such switches although I am 100% sure that I am neither touching the BFB2, SPRMOD nor DB1M bits (?)

Regards

Mark