Which command to use to make a soft reset on K64F (KDS2 and KSDK110)?

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

Which command to use to make a soft reset on K64F (KDS2 and KSDK110)?

Jump to solution
2,825 Views
dafodil
Contributor III

Hi,

I need to be able to reset by software my application that works on K64F.

Do you know a command ?

Bernard

Tags (2)
0 Kudos
1 Solution
1,360 Views
BlackNight
NXP Employee
NXP Employee

And just in case: attached the KinetisTools component which can do this both for Kinetis SDK and non-SDK projects

void KIN1_SoftwareReset(void)

{

  /* Generic way to request a reset from software for ARM Cortex */

  /* See https://community.freescale.com/thread/99740

     To write to this register, you must write 0x5FA to the VECTKEY field, otherwise the processor ignores the write.

     SYSRESETREQ will cause a system reset asynchronously, so need to wait afterwards.

   */

#if KIN1_IS_USING_KINETIS_SDK

  SCB->AIRCR = (0x5FA<<SCB_AIRCR_VECTKEY_Pos)|SCB_AIRCR_SYSRESETREQ_Msk;

#else

  SCB_AIRCR = SCB_AIRCR_VECTKEY(0x5FA) | SCB_AIRCR_SYSRESETREQ_MASK;

#endif

  for(;;) {

    /* wait until reset */

  }

}

Erich

View solution in original post

0 Kudos
7 Replies
1,358 Views
BlackNight
NXP Employee
NXP Employee

Hi Bernard,

This is a generic way for ARM Cortex to perform a software reset:

void KIN1_SoftwareReset(void)

{

  /* generic way to request a reset from software for ARM Cortex */

  SCB_AIRCR = SCB_AIRCR_VECTKEY(0x5FA) | SCB_AIRCR_SYSRESETREQ_MASK;

  for(;;) {

    /* wait until reset */

  }

}

If you are using Processor Expert: that functionality/function is present in the 'KinetisTools' component:

pastedImage_7.png

available on SourceForge (see McuOnEclipse Releases on SourceForge | MCU on Eclipse).

Erich

1,358 Views
dafodil
Contributor III

Hi Erich,

I got an error message, all macros are undeclared, where can I find the declaration? (my project is with KDSK110 and PE)

Bernard

0 Kudos
1,358 Views
BlackNight
NXP Employee
NXP Employee

Hi Bernard,

for the SDK, it is in core_cm4.h

and would be

SCB->AIRCR = (0x5FA<<SCB_AIRCR_VECTKEY_Pos)|SCB_AIRCR_SYSRESETREQ_Msk;

Erich

0 Kudos
1,361 Views
BlackNight
NXP Employee
NXP Employee

And just in case: attached the KinetisTools component which can do this both for Kinetis SDK and non-SDK projects

void KIN1_SoftwareReset(void)

{

  /* Generic way to request a reset from software for ARM Cortex */

  /* See https://community.freescale.com/thread/99740

     To write to this register, you must write 0x5FA to the VECTKEY field, otherwise the processor ignores the write.

     SYSRESETREQ will cause a system reset asynchronously, so need to wait afterwards.

   */

#if KIN1_IS_USING_KINETIS_SDK

  SCB->AIRCR = (0x5FA<<SCB_AIRCR_VECTKEY_Pos)|SCB_AIRCR_SYSRESETREQ_Msk;

#else

  SCB_AIRCR = SCB_AIRCR_VECTKEY(0x5FA) | SCB_AIRCR_SYSRESETREQ_MASK;

#endif

  for(;;) {

    /* wait until reset */

  }

}

Erich

0 Kudos
1,358 Views
dafodil
Contributor III

Hi Erich,

It's not working, maybe it's because I use MQX with RTCS.  The app stop, but don't restart.

I found a solution with WDOG from KSDK and the WDOG_DRV_ResetSystem();

0 Kudos
1,359 Views
BlackNight
NXP Employee
NXP Employee

Not sure why this does not work with MQX. It works fine for me with the Kinetis SDK and FreeRTOS.

0 Kudos
1,360 Views
dafodil
Contributor III

In fact, the use of kinetis tools make some instability inside my project after adding ksdk component.

I will try again with the new KDS3!

For now, I reboot the app with timeout watchdog. It's not really the best solution, but it works.

0 Kudos