Other Parts Discussed in Thread: UNIFLASH, CONTROLSUITE
Hello,
I probably did something stupid writing in some wrong place in the M3 flash memory.
Now it looks like it is locked and I don't know how to unlock it.
When I try to erase any sector, I get the following error message :
From CCS 6.2 :
"Cortex_M3_0: Flash Programmer: Error erasing Sector N. Operation Cancelled.
Cortex_M3_0: File Loader: Memory write failed: Unknown error"
From Uniflash 4.2:
"[9/25/2017, 3:36:39 PM] [ERROR] Cortex_M3_0: Flash Programmer: Error erasing Sector N. Operation Cancelled.
[9/25/2017, 3:36:39 PM] [ERROR] Cortex_M3_0: Flash Programmer: Error erasing flash. Please check if the device is locked."
Here it shows sector N but I have the same error with other sectors.
I've read that this could be caused by witting new values in CSM PSWDs/KEYs registers. When I read the values using uniflash at 0x200000, 0x200004, 0x200008 and 0x20000C, I read 0x00000000. Same for PSWDs/KEYs at 0x27FFF0, 0x27FFF4, 0x27FFF8 and 0x27FFFC.
Could anyone tell me how I can unlock my device? Maybe I wrote passwords without knowing it but now I don't know how to recover them.
Please tell me I have not broken my device!
Thanks for the help.
Ril
EDIT:
I've just read in the technical reference manual :
"""
If the password locations of a zone have all 128 bits as ones, the zone is labeled unsecure. Since new
flash devices have erased flash (all ones), only a read of the password locations is required to bring any
zone into unsecure mode. If the password locations of a zone have all 128 bits as zeros, the zone is
secure, regardless of the contents of the CSMKEY registers. The user should not use all zeros as a
password or reset the device during an erase of the flash. Resetting the device during an erase routine
can result in either an all zero or unknown password. If a device is reset when the password locations are
all zeros, the device cannot be unlocked by the password match flow described in Section 1.10.3.2. Using
a password of all zeros will seriously limit user’s ability to debug secure code or re-program the flash.
NOTE:If a device is reset while the password locations of a zone are all zeros or an unknown value,
that zone will be permanently locked unless a method to run the flash erase routine from
secure SARAM is embedded into the flash or OTP. Care must be taken when implementing
this procedure to avoid introducing a security hole.
"""
This almost made my heart stop :/ Please tell me there is a way to recover my device and that it is not that easy to mess up a device!!!
EDIT 2:
A few more questions...
1. Actually, I'm not even sure I wrote all zeroes as CSM password. Earlier, I said that I read the value of 0x200000 to 0x20000C and it showed zeros in uniflash. Is that supposed to be the password? It shouldnt be possible to read the password value just like that right ?
2. What is the difference between
- 0x200000 to 0x20000C area
- 0x27FFF0 to 0x27FFFC area
?
3. Is there anyway to know the actual value of the CSM passwords ? Like at least be sure that it is permanently locked...
4. When you know the password, what is the proper way of unlocking the device ? Using uniflash ?
Thanks again.