Flash Security byte in Flash Config Field and FSEC are not the same

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flash Security byte in Flash Config Field and FSEC are not the same

1,495 Views
oliverkubat
Contributor I

Hi,

 

I use the TRK-S12ZVFP64 development board and CodeWarrior Version: 10.6.4

 

I want to secure the MCU and unsecure it via Verify Backdoor Access Key Command.

 

I configured the Flash Config Field as follow:

#define FLASHSECURITYBYTE 0xBD

/* configure flash configuration field */
const unsigned char FCF_FlashConfigurationField_a[] @0xFFFE00 = {0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFA, FLASHSECURITYBYTE };

 

Before i execute the Verify Backdoor Access Key Command i check the FSEC register like that

   if(((*(unsigned char *)0x0381)) == FLASHSECURITYBYTE )
   {
        /* do something */
   }

But FLASHSECURITYBYTE and the Value in the FSEC register arent the same...

 

When i use 0xBD for FLASHSECURITYBYTE, then 0xFF is stored in FSEC (MCU secured but no Backdoor Access Key)

When i use 0xBC or 0xBF for FLASHSECURITYBYTE, then 0xBE is stored in FSEC (MCU is unsecured)

 

That's why the Verify Backdoor Access Key Command fails every time (ACCERR is set in FSTAT)

Is there any solution to get 0xBD in the FSEC register?

 

Regards

Oliver

Labels (1)
2 Replies

597 Views
iggi
NXP Employee
NXP Employee

Hi,

Checking the FSEC before VerifyBeckdoorAccess command execution is not necessary.

The actual problem is that you are executing code from the flash block which is being programmed. This simultaneous action is not possible. Since, there is one flash block on the device, the code i.e. the command must be executed from RAM.

Please see this example we shared on the community which you can use with S12ZVFP as well:

SW example of Security feature with Backdoor Access Key option for S12ZVL MagniV microcontroller 

Hope it helps,

iggi


-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

597 Views
oliverkubat
Contributor I

Hi iggi,

Thanks for your answer.

In my Code, the command is executing from RAM.

Checking the FSEC was just for testing.

I checked the Flash Configuration Field after flashing the s12z and the problem is that the SEC Bits there aren't the same  as in my code above (the configuration of the flash config field).

When i use 0xBD for FLASHSECURITYBYTE, then 0xFF is stored in the Flash Config Field of my microcontroller

and when i use 0xBC or 0xBF, then 0xBE is stored.

I use "Flash File to Target" in Codewarrior. So could it be possible, that this flasher changes my flash security byte.

Regards,

Olli