AnsweredAssumed Answered

Permanently Unsecuring Flash without mass erasing...

Question asked by Alexander Fries on Jan 27, 2011
Latest reply on Feb 1, 2011 by kef

Hi...

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:

 

WriteBAckDoorKey();

if( FlashIsUnsecured() )

{

     EraseTopSector();

    set NVFPROT to 'protected top 8K'

    set NVFSEC  to KEY_DISABLED, SEC_DISABLED

    RestoreTopSector();

}

 

[We have been locking the flash, and unlocking it temporarily,

for quite a while now, and we are confident that the code 'blocks'

are OK]

 

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,

Sebastian

Outcomes