xmc4500 software reset

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User10000
Level 1
Level 1
Hi.

I need to reset by software xmc4500 CPU core.

So, I added code as..

PPB->AIRCR |= (0x5FA << 16);
PPB->AIRCR |= PPB_AIRCR_VECTRESET_Msk;

But target bord didn't reset and PPB->AIRCR register value were not changed also(remain all 0's).

Please advise me what is wrong.


Best regards.

do-yoon Ahn
0 Likes
4 Replies
User10215
Level 4
Level 4
First like received
Hi do-yoon,

I suggest using the CMSIS-Function "void NVIC_SystemReset(void)" which essentially does what you want.

If you want to know what you did wrong: have a look at the reference manual and the bitfield "VECTKEY" in the "AIRCR"-register. It says: "VECTKEY, reads as 0xFA05".
What this line "PPB->AIRCR |= (0x5FA << 16);" in your program does, is to read the register and OR it with the stuff you wrote righthand to the equal sign, which means
you are ORing "0xFA05" with "0x5FA" which does not give the correct key for writing to the register.
Also to write to the register everything you want to write to it has to include the key, so this line "PPB->AIRCR |= PPB_AIRCR_VECTRESET_Msk;" alone
doesn't work because you aren't writing the key along with it.
Also..." PPB_AIRCR_VECTRESET_Msk" is the wrong bit to set. Reading the reference manual yields: "Reserved for Debug use. This bit reads as 0. When writing to the register you must
write 0 to this bit, otherwise behavior is Unpredictable".
So it's not a good idea to set this bit. The Bit with the mask "PPB_AIRCR_SYSRESETREQ_Msk" is what you need.

Anyway, as I said, I would suggest to use the function "void NVIC_SystemReset(void)" for a software reset as it is does contain more stuff then just setting the SYSRESETREQ-bit
which results in a safer reset.

Greetings,
Niclas
0 Likes
User10000
Level 1
Level 1
Thank you Niclas.

I correct the wrong code as you suggest.
Now target works well.

Best regards.
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

This is working for me, base on DAVE3 platform.



#define SCU_RESET_RSTCLR_RSCLR_Pos 0
#define PPB_AIRCR_SYSRESETREQ_Pos 2
#define PPB_AIRCR_VECTKEY_Pos 16
#define PPB_AIRCR_PRIGROUP_Pos 8

static void Reset_MCU(void)
{
SCU_GENERAL->GPR[0] = 0x08040000;
/* Clear the reset cause field for proper reset detection of the ssw */
SCU_RESET->RSTCLR = 1< /* request system reset */
PPB->AIRCR = 1 << PPB_AIRCR_SYSRESETREQ_Pos |
0x5FA<}

0 Likes
User10000
Level 1
Level 1
Hi Travis.

Thank you very much.
0 Likes