Hi Everyone
We were previously working on K60M512Z chip and the following code worked perfect for reseting the device programatically:
void deviceReset(void)
{
VCORTEX_SCB_STRUCT_PTR scb = (VCORTEX_SCB_STRUCT_PTR)&(((CORTEX_SCS_STRUCT_PTR)CORTEX_PRI_PERIPH_IN_BASE)->SCB);
uint32_t temp_AIRCR=0;
temp_AIRCR = (UINT)scb->AIRCR; //Read AIRCR register
temp_AIRCR &= 0x0000ffff; //DES mask of the top 16-bits
temp_AIRCR |= 0x05Fa0000; //DES When writing to AIRCR the update 16-bit must be "0x05FA" per ARMv7-M Architecture Reference Manual (must register on ARM.com to get)
temp_AIRCR |= SCB_AIRCR_SYSRESETREQ_MASK; //DES set the SYSRESETREQ bit to generate software reset
// Reboot...
_time_delay (50);
scb->AIRCR = temp_AIRCR;
for(;;)
return;
}
however im testing the same code with K64 chip (MK64FN1M0VLQ12) and its not causing the reset anymore.
Both setups are using MQX 4.1.0
Can anyone shed any light on whats wrong?
thank you in advance
Hi Igor,
I tried your code and it worked using MQX4.1 with the MQX/examples/event project for TWR-K64F120M.
I did have to change the variable
temp_AIRCR = (UINT)scb->AIRCR; //Read AIRCR register
as I didn't have UINT defined so made it uint32_t.
My terminal output looks like:
Starting event example:
Tick 0
Tick 1
Tick 2
Tick 3
Tick 4
Tick 5
Tick 6
Tick 7
Tick 8
Tick 9
Tick 10
Starting event example:
Tick 0
Tick 1
Tick 2
Tick 3
File attached (event.c).
Regards,
David
Hi Igor,
Please try using next instruction:
SCB_AIRCR = 0x05FA0004;
Regards,
Carlos