Dear all,
I noticed that in the register AOREG1 (please refer to UM11126 document) there are two bits:
BIT 7: SYSTEMRESET(the last chip reset was caused by a System Reset requested by the ARM CPU)
and
BIT 9: SWRRESET (The last chip reset was caused by a Software event)
I'm able to reset the CPU by calling the __NVIC_SystemReset() function but I can't find any routine or any trick to generate a 'software reset event' in order to set the the bit 9 in AOREG1 register.
Did you have a similar problem ?
How did you fix it ?
Thank you very much for your help and cooperation
Solved! Go to Solution.
Hi, @_Ferrari_
Please do not use Debug. When you run debug and click Stop, the chip will not be detected because the chip keeps resetting.
You can use the GUI flash tool to download the code and view the reset status on the serial port.
Best regards, Alex
Hi, @_Ferrari_
If you want SWRRESET to position 1, you can do so with the following code:
PMC->RESETCTRL|=1<<3;
SYSCON->SWR_RESET= 0x5a000001;
In my opinion, the __NVIC_SystemReset() function does achieve a reset, but it is actually an operation done to the kernel, not a real software reset.
I demonstrated with LPC55S69, checking the status of SWRRESET and SYSTEMRESET. Refer to the following figure:
The test code is as follows:
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_power.h"
int main(void)
{
char ch;
/* Init board hardware. */
/* set BOD VBAT level to 1.65V */
POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);
/* attach main clock divide to FLEXCOMM0 (debug console) */
CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitDebugConsole();
#if !defined(DONT_ENABLE_FLASH_PREFETCH)
/* enable flash prefetch for better performance */
SYSCON->FMCCR |= SYSCON_FMCCR_PREFEN_MASK;
#endif
PRINTF("hello world.\r\n");
if(((PMC->AOREG1>>7)&1)==1)
{
PRINTF("sysreset=1\r\n");
}
else if(((PMC->AOREG1>>7)&1)==0)
{PRINTF("sysreset=0\r\n");}
if(((PMC->AOREG1>>9)&1)==1)
{
PRINTF("softreset=1\r\n");
}
else if(((PMC->AOREG1>>9)&1)==0)
{PRINTF("softreset=0\r\n");}
PMC->RESETCTRL|=1<<3;
SYSCON->SWR_RESET= 0x5a000001;
//__NVIC_SystemReset();
while (1)
{
ch = GETCHAR();
PUTCHAR(ch);
}
}
Best regards, Alex
dear @Alex_Wang
Thank you for your answer.
I just I copied and pasted your software in my 'hello world' sdk example.
I'm using LPC55S28-EVK evaluation board
Hi, @_Ferrari_
Please do not use Debug. When you run debug and click Stop, the chip will not be detected because the chip keeps resetting.
You can use the GUI flash tool to download the code and view the reset status on the serial port.
Best regards, Alex