 
					
				
		
Hi,
I need to be able to reset by software my application that works on K64F.
Do you know a command ?
Bernard
Solved! Go to Solution.
 
					
				
		
 BlackNight
		
			BlackNight
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
 BlackNight
		
			BlackNight
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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:
available on SourceForge (see McuOnEclipse Releases on SourceForge | MCU on Eclipse).
Erich
 
					
				
		
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
 
					
				
		
 BlackNight
		
			BlackNight
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
 BlackNight
		
			BlackNight
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
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();
 
					
				
		
 BlackNight
		
			BlackNight
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Not sure why this does not work with MQX. It works fine for me with the Kinetis SDK and FreeRTOS.
 
					
				
		
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.
