2018-11-27 09:42 AM
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
Solved! Go to Solution.
2018-11-27 12:48 PM
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
2018-11-27 12:48 PM
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
2018-11-27 01:58 PM
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