The cases where the MCU may be locked after the keys are loaded in CSEc

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

The cases where the MCU may be locked after the keys are loaded in CSEc

323 Views
icypistol
Contributor I

I'm facing a issue that the MCU is locked after load keys in CSEc. (unlock kinetis tried, but still not worked, as below picture)

What I did were just loaded keys with NXP example project, and then flash my image via SWD.

Now I would like to find out the possibilities where the MCU is locked in my operation. Before that,

Could you give me some feedback regarding my doubts below?

1. The command of Mass Erase will set FSEC[SEC] = 10b(unsecure state), or any other values(secure state)?

2. When I flash a image with the FSEC[SEC] = 10b. Does it means the debugger will firstly erase FSEC[SEC] = 11b, then program FSEC[SEC] = 10b?

3. What's the cases where the FSEC[SEC] will be set as a secure state value? I noticed that when I flash a image, the FSEC[SEC] can be set. How about the case of a power loss during image flashing? Do you know any other cases?

 

icypistol_0-1685780094944.png

 

Thanks.

0 Kudos
1 Reply

242 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @icypistol,

1.

Yes, the mass erase operation sets the FSEC[SEC] byte in the flash configuration field to the unsecure state.

AN12130 Production Flash Programming Best Practices for S32K1xx MCUs

https://www.nxp.com/docs/en/application-note/AN12130.pdf

danielmartynek_0-1685955731334.png

However, the CSEc keys are allocated, the mass erase is blocked by the engine.

The debugger can erase the flash by sectors.

danielmartynek_1-1685955892202.png

 

2.

That would be a question for the vendor of the debugger.

But there is no need to erase the first sector (0x0000 - 0x1000) if the phrase containing the FSEC in the image matches the value in the flash (FSEC = 0xFE)

 

3.

If the MCU is reset while the first sector is erased (FSEC = 0xFF), the MCU will get locked, and since Mass erase is blocked by CSEc, the MCU will be locked permanently.

Unfortunately, this must be taken into consideration whenever the CSEc is used.

 

Best regards,

Daniel