Verify Backdoor Key causes Reset

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

Verify Backdoor Key causes Reset

1,021 Views
shawn_lammers
Contributor II

We have a project using a 9S12XEQ512 micro where we need to secure the micro but allow access through the backdoor key feature.

Add added the ability to our application program accept a key over a serial port and then use the flash commands to perform the key verification process and this worked fine.

I then moved the exact same code to our bootloader and now when I execute the process by writing to the FSTAT register the micro resets. The strange thing is this only happens when running in single chip mode. When I run it through the debugger the code executes as expected. The verify key command fails as its not supported in special single chip mode, but at least the micro does not reset.

In single chip mode, if I just comment out the line to complete the sequence

// FSTAT = 0x80;

then the micro does not reset so I am quite sure this is causing the problem.

Does anyone know why the mico would reset just be executing a flash command sequence?

0 Kudos
5 Replies

761 Views
RadekS
NXP Employee
NXP Employee

Hi Shawn,

It looks like you may have some ECC issue with cumulative write into 0xFF08..0xFF0F phase.

Did you use FLASH NOUNSECURE command in bootloader preload command file?

More details:

https://community.nxp.com/docs/DOC-93803

 

Did you enable COP in your bootloader? If yes, is there any potentially endless loop in your code?

The difference in behavior between Normal and special mode is typically based on incorrect writes into registers with write-once condition like COPCTL register or registers without write access like TCNT. Please ensure that you write registers like COPCTL by single command. For example COPCTL=0x00;

 

Are you sure, that application and bootloader memories do not overlap each other?

I hope it helps you.

Have a great day,
Radek

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

0 Kudos

761 Views
gordondoughman
Contributor III

Shawn,

I'm not sure why the difference when the device is in Special Single-chip mode, but from Section 27.4.2.12, Verify Backdoor Access Key Command, of the MC9S12XE-Family Reference Manual Rev. 1.25, "The Verify Backdoor Access Key command must not be executed from the Flash block containing the backdoor comparison key to avoid code runaway." So, in the S12XEQ512, you must execute the Verify Backdoor Access Key Command either from Flash Block 1 (0x780000 - 0x7BFFFF) or from RAM to avoid code runaway.

Regards,

Gordon 

0 Kudos

761 Views
shawn_lammers
Contributor II

I moved the function to a RAM routine and this did not help. It still resets during write to FSTAT to initiate the verification.

Interesting enough, if I do not program the back door key and FSEC flash location (leave it 0xFE) the program runs fine and does not reset. But if I program my nackdoor key and set FSEC to 0xBE or 0xBC, it will reset.

0 Kudos

761 Views
gordondoughman
Contributor III

Is your code waiting in the function copied into RAM until the CCIF flag is set?

Regards,

Gordon

0 Kudos

761 Views
shawn_lammers
Contributor II

Thanks for the heads up. I have rev 1.19 and this note is not there. I am indeed running the code from 0x7FF000.

I can see why you can not program the flash from code running in flash, but I would not have thought checking the key would have the same issue.

I will try moving this function to ram and see if that works,

0 Kudos