I am trying to unsecure flash permanently, without a 'mass erase',
and it isn't working: the device is unsecured, but reverts back to the
secured state after a reset.
Device is mc9s12c32
The data sheet states: "Once the MCU is unsecured, the Flash
security byte can be programmed to the unsecure state, if desired"
Pseudo-code for my latest version of code looks like:
if( FlashIsUnsecured() )
set NVFPROT to 'protected top 8K'
set NVFSEC to KEY_DISABLED, SEC_DISABLED
[We have been locking the flash, and unlocking it temporarily,
for quite a while now, and we are confident that the code 'blocks'
I have tried a few variations on the above, (e.g. restoring the
trashed key in the 'if' block, setting NV_FSEC to KEY_ENABLED),
but have not had any success.
It seems as if permanently unsecuring the flash requires a mass
erase. This would make the operation similar to that of changing
the protection setting in NV_FPROT, and is logical enough.
Does anyone know if this is indeed the case?
With thanks, and best regards,