Jul 17, 2015
06:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2015
06:57 PM
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
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
- Tags:
- IFX
4 Replies
Jul 19, 2015
06:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 19, 2015
06:54 AM
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
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
Jul 19, 2015
07:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 19, 2015
07:31 PM
Thank you Niclas.
I correct the wrong code as you suggest.
Now target works well.
Best regards.
I correct the wrong code as you suggest.
Now target works well.
Best regards.
Jul 22, 2015
03:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 22, 2015
03:03 AM
Hi,
This is working for me, base on DAVE3 platform.
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<}
Jul 22, 2015
04:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 22, 2015
04:56 PM
Hi Travis.
Thank you very much.
Thank you very much.