S32K148EVB not flashing and locked

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

S32K148EVB not flashing and locked

Jump to solution
425 Views
Soratari
Contributor I

Hello,

I am currently studying with the S32K148 EVB.

I modified the FlexCAN example in RTD 4.4, changing the mode from Loopback to Normal, added additional ports, and flashed the firmware using OpenSDA for testing.

The first flashing was successful, but when I tried to flash again, the debugger connection was disconnected, and the device was shown as being in a Secure state.

After that, I attempted recovery using Multilink (Kinetis), but it failed.

My question is:

Is there any code or configuration in this FlexCAN project hat could lock the EVB or place the device into a secure/locked state?

Are there any settings or common mistakes I should be careful about to avoid this situation in the future?

I would really appreciate any guidance, as I want to avoid making the same mistake again.

platform: S32 Design Studio 3.5

Thank you very much.

0 Kudos
Reply
1 Solution
373 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Soratari

Is there any code or configuration in this FlexCAN project that could lock the EVB or place the device into a secure/locked state?

Not really. I can see inside the startup_cm4.s file that the Flash Config field is set to unsecured with mass erased enabled: 

.long 0xFFFF7FFE     /* FDPROT:FEPROT:FOPT:FSEC (0xFE = unsecured) */

However, if during a later flash the bytes were changed or written as 0, the device ended up secured after a subsequent reset. 
 

Are there any settings or common mistakes I should be careful about to avoid this situation in the future?

You can refer to AN12130: Production Flash Programming Best Practices for S32K1xx MCUs. Section 5 lists the common problems found when programming the device. Keep in mind that when the flash config field is programmed with a value that enables security and disables mass erase and backdoor key accesses, then flash cannot be programmed anymore.

There are some resources in the public community which you can refer. Please try to unsecure the device with the steps mentioned here: Re: Unbricking S32K146 - NXP Community.

And use the "unlock Kinetis" command to trigger the SWD mass erase operation while the MCU is held in reset (connect PTA5 reset_b to VSS).

You can also try Emergency Kinetis Recovery by Full Chip Erase:

Julin_AragnM_0-1767979245044.png

Best regards,
Julián

 

View solution in original post

0 Kudos
Reply
2 Replies
374 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Soratari

Is there any code or configuration in this FlexCAN project that could lock the EVB or place the device into a secure/locked state?

Not really. I can see inside the startup_cm4.s file that the Flash Config field is set to unsecured with mass erased enabled: 

.long 0xFFFF7FFE     /* FDPROT:FEPROT:FOPT:FSEC (0xFE = unsecured) */

However, if during a later flash the bytes were changed or written as 0, the device ended up secured after a subsequent reset. 
 

Are there any settings or common mistakes I should be careful about to avoid this situation in the future?

You can refer to AN12130: Production Flash Programming Best Practices for S32K1xx MCUs. Section 5 lists the common problems found when programming the device. Keep in mind that when the flash config field is programmed with a value that enables security and disables mass erase and backdoor key accesses, then flash cannot be programmed anymore.

There are some resources in the public community which you can refer. Please try to unsecure the device with the steps mentioned here: Re: Unbricking S32K146 - NXP Community.

And use the "unlock Kinetis" command to trigger the SWD mass erase operation while the MCU is held in reset (connect PTA5 reset_b to VSS).

You can also try Emergency Kinetis Recovery by Full Chip Erase:

Julin_AragnM_0-1767979245044.png

Best regards,
Julián

 

0 Kudos
Reply
23 Views
Soratari
Contributor I

Hello, thank you so much for replying.
When I checked it using JLink, it entered the Secure state and the mass erased state was disabled.
Maybe there was a problem with the data during Flash..

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2290583%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K148EVB%20not%20flashing%20and%20locked%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2290583%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20am%20currently%20studying%20with%20the%20S32K148%20EVB.%3C%2FP%3E%3CP%3EI%20modified%20the%20FlexCAN%20example%20in%20RTD%204.4%2C%20changing%20the%20mode%20from%20Loopback%20to%20Normal%2C%20added%20additional%20ports%2C%20and%20flashed%20the%20firmware%20using%20OpenSDA%20for%20testing.%3C%2FP%3E%3CP%3EThe%20first%20flashing%20was%20successful%2C%20but%20when%20I%20tried%20to%20flash%20again%2C%20the%20debugger%20connection%20was%20disconnected%2C%20and%20the%20device%20was%20shown%20as%20being%20in%20a%20Secure%20state.%3C%2FP%3E%3CP%3EAfter%20that%2C%20I%20attempted%20recovery%20using%20Multilink%20(Kinetis)%2C%20but%20it%20failed.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EMy%20question%20is%3A%3C%2FP%3E%3CP%3EIs%20there%20any%20code%20or%20configuration%20in%20this%20FlexCAN%20project%20hat%20could%20lock%20the%20EVB%20or%20place%20the%20device%20into%20a%20secure%2Flocked%20state%3F%3C%2FP%3E%3CP%3EAre%20there%20any%20settings%20or%20common%20mistakes%20I%20should%20be%20careful%20about%20to%20avoid%20this%20situation%20in%20the%20future%3F%3C%2FP%3E%3CP%3EI%20would%20really%20appreciate%20any%20guidance%2C%20as%20I%20want%20to%20avoid%20making%20the%20same%20mistake%20again.%3C%2FP%3E%3CP%3Eplatform%3A%20S32%20Design%20Studio%203.5%3C%2FP%3E%3CP%3EThank%20you%20very%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2291108%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K148EVB%20not%20flashing%20and%20locked%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2291108%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F258618%22%20target%3D%22_blank%22%3E%40Soratari%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EIs%20there%20any%20code%20or%20configuration%20in%20this%20FlexCAN%20project%20that%20could%20lock%20the%20EVB%20or%20place%20the%20device%20into%20a%20secure%2Flocked%20state%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ENot%20really.%20I%20can%20see%20inside%20the%20startup_cm4.s%20file%20that%20the%20Flash%20Config%20field%20is%20set%20to%20unsecured%20with%20mass%20erased%20enabled%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3C!--ScriptorStartFragment--%3E.long%200xFFFF7FFE%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20FDPROT%3AFEPROT%3AFOPT%3AFSEC%20(0xFE%20%3D%20unsecured)%20*%2F%3C!--ScriptorEndFragment--%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3EHowever%2C%20if%20during%20a%20later%20flash%20the%20bytes%20were%20changed%20or%20written%20as%200%2C%20the%20device%20ended%20up%20secured%20after%20a%20subsequent%20reset.%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3EAre%20there%20any%20settings%20or%20common%20mistakes%20I%20should%20be%20careful%20about%20to%20avoid%20this%20situation%20in%20the%20future%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EYou%20can%20refer%20to%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN12130.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EAN12130%3A%20Production%20Flash%20Programming%20Best%20Practices%20for%20S32K1xx%20MCUs.%3C%2FA%3E%26nbsp%3BSection%205%20lists%20the%20common%20problems%20found%20when%20programming%20the%20device.%20Keep%20in%20mind%20that%20when%20the%20flash%20config%20field%20is%26nbsp%3Bprogrammed%20with%20a%20value%20that%20enables%20security%20and%20disables%20mass%20erase%20and%20backdoor%20key%20accesses%2C%20then%20flash%20cannot%20be%20programmed%20anymore.%3C%2FP%3E%0A%3CP%3EThere%20are%20some%20resources%20in%20the%20public%20community%20which%20you%20can%20refer.%20Please%20try%20to%20unsecure%20the%20device%20with%20the%20steps%20mentioned%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FUnbricking-S32K146%2Fm-p%2F937230%3FcommentID%3D1166947%23comment-1166947%22%20target%3D%22_blank%22%3ERe%3A%20Unbricking%20S32K146%20-%20NXP%20Community%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAnd%20use%20the%20%22unlock%20Kinetis%22%20command%20to%20trigger%20the%20SWD%20mass%20erase%20operation%20while%20the%20MCU%20is%20held%20in%20reset%20(connect%20PTA5%20reset_b%20to%20VSS).%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EYou%20can%20also%20try%20Emergency%20Kinetis%20Recovery%20by%20Full%20Chip%20Erase%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Julin_AragnM_0-1767979245044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Julin_AragnM_0-1767979245044.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372355iFDD0F55C0CA40852%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Julin_AragnM_0-1767979245044.png%22%20alt%3D%22Julin_AragnM_0-1767979245044.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E