LPC11C24 reset does not clear SYSRSTSTAT register

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC11C24 reset does not clear SYSRSTSTAT register

2,262件の閲覧回数
adamrakam
Contributor III

Hi,

On LPC11C24 (Cortex M0) i try to find a cause of my MCU reseting.  User manual says that reset value of the SYSRSTSTAT  register is 0 after RESET. But this is not what I observe. Using MCUXpresso when i pause debugging and press 'Restart' button I see POR in SYSRSTSTAT bit still set. This should not be according to table below. Based on my experiments EXTRST and SYSRST reset sources do not clear POR flag. Does this mean that not all RESET sources are equal? Why are not all reset sources set to zero when executing system reset SYSRST via debugger?

pastedImage_1.png

Thank you !

6 返答(返信)

1,855件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi adam rakam,

Thank you for your interest in NXP Semiconductor products and 
for the opportunity to serve you.

I' was wondering if you can introduce the steps of testing, then I can replicate the 'phenomenon' on my site.

I'm looking forward to your reply.

TIC

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,855件の閲覧回数
adamrakam
Contributor III

Hi

step 1

power up the OM13093 eval board

step 2

start a debug session by pressing button #1. Now 3 bits are set in SYSRSTSTAT register - POR, EXTRST, SYSRST

pastedImage_1.png

step 3

run program

step 4

pause program 

step 5

reset progam by pressing a "Restart" button #2. All 3 bits are still set in SYSRSTSTAT register even though there was no POR.

step 6

run program

step 7

press reset button on the eval board. This will cause the IDE to show error msg. Press OK

step 8

reset progam by pressing a "Restart" button #2. All 3 bits are still set in SYSRSTSTAT register even though there was no POR.

Only when I clear SYSRSTSTAT register by calling  Chip_SYSCTL_ClearSystemRSTStatus(0x1F); function will I see real source of my reset. Why is that ?

Thanks !

1,854件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi adam rakam,

Thanks for your reply.

I had replicated the issue on my site, and I suspect this issue is about the debugging operation.

You can use the following code to get the value of the SYSRSTSTAT register, then using the UART to send it to terminal without entering the debugger mode.

sysResetStatus = Chip_SYSCTL_GetSystemRSTStatus();

TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,855件の閲覧回数
adamrakam
Contributor III

Hi,

I run this code without debugger on the OM13093_LPC11C24 eval board:

// from sysctl_11xx.h
#define SYSCTL_RST_POR    (1 << 0)    /*!< POR reset status */
#define SYSCTL_RST_EXTRST (1 << 1)    /*!< External reset status */
#define SYSCTL_RST_WDT    (1 << 2)    /*!< Watchdog reset status */
#define SYSCTL_RST_BOD    (1 << 3)    /*!< Brown-out detect reset status */
#define SYSCTL_RST_SYSRST (1 << 4)    /*!< software system reset status */

uint32_t reset_source = 0;

int main()
{
    reset_source = Chip_SYSCTL_GetSystemRSTStatus();
    Chip_GPIO_SetPinDIROutput(LPC_GPIO, 3, 0);
    Chip_GPIO_SetPinState(LPC_GPIO, 3, 0, 0);
    Chip_GPIO_SetPinDIROutput(LPC_GPIO, 3, 1);
    Chip_GPIO_SetPinState(LPC_GPIO, 3, 1, 0);
    Chip_GPIO_SetPinDIROutput(LPC_GPIO, 3, 2);
    Chip_GPIO_SetPinState(LPC_GPIO, 3, 2, 0);
    if(reset_source & SYSCTL_RST_POR)
        Chip_GPIO_SetPinState(LPC_GPIO, 3, 0, 1);
    if(reset_source & SYSCTL_RST_EXTRST)
        Chip_GPIO_SetPinState(LPC_GPIO, 3, 1, 1);
    if(reset_source & SYSCTL_RST_SYSRST)
        Chip_GPIO_SetPinState(LPC_GPIO, 3, 2, 1);

    while (1)
    {
        if(Chip_GPIO_GetPinState(LPC_GPIO, 2, 7) == 1)
        {
            Chip_SYSCTL_ClearSystemRSTStatus(0x1F);
            reset_source = Chip_SYSCTL_GetSystemRSTStatus();
            if(reset_source & SYSCTL_RST_POR)
                Chip_GPIO_SetPinState(LPC_GPIO, 3, 0, 1);
            else
                Chip_GPIO_SetPinState(LPC_GPIO, 3, 0, 0);

            if(reset_source & SYSCTL_RST_EXTRST)
                Chip_GPIO_SetPinState(LPC_GPIO, 3, 1, 1);
            else
                Chip_GPIO_SetPinState(LPC_GPIO, 3, 1, 0);

            if(reset_source & SYSCTL_RST_SYSRST)
                Chip_GPIO_SetPinState(LPC_GPIO, 3, 2, 1);
            else
                Chip_GPIO_SetPinState(LPC_GPIO, 3, 2, 0);
        }
        
        if(Chip_GPIO_GetPinState(LPC_GPIO, 0, 3) == 1)
        {
            NVIC_SystemReset();
        }
    }

    return 0;
}

Code explanation:

pin 2_7,input - when 1 it clears SYSRSTSTAT register by caling Chip_SYSCTL_ClearSystemRSTStatus(0x1F) function
pin 0_3,input - when 1 it resets the MCU by calling NVIC_SystemReset() function
pin 3_0,output - state of the SYSCTL_RST_POR bit in SYSRSTSTAT register
pin 3_1,output - state of the SYSCTL_RST_EXTRST bit in SYSRSTSTAT register
pin 3_2,output - state of the SYSCTL_RST_SYSRST bit in SYSRSTSTAT register

Running the code above gives me these results

After powering the board up  (HW MCU reset):
SYSCTL_RST_POR    = 1
SYSCTL_RST_EXTRST = 1
SYSCTL_RST_SYSRST = 0

pressing a reset button on the eval board (HW MCU reset)
SYSCTL_RST_POR    = 1
SYSCTL_RST_EXTRST = 1
SYSCTL_RST_SYSRST = 0

after setting pin 0_3 to 1 (SW MCU reset - NVIC_SystemReset())
SYSCTL_RST_POR    = 1
SYSCTL_RST_EXTRST = 1
SYSCTL_RST_SYSRST = 1

after setting pin 2_7 to 1 (SW SYSRSTSTAT resister reset - Chip_SYSCTL_ClearSystemRSTStatus(0x1F))
SYSCTL_RST_POR    = 0
SYSCTL_RST_EXTRST = 0
SYSCTL_RST_SYSRST = 0

pressing a reset button on the eval board (HW MCU reset)
SYSCTL_RST_POR    = 0
SYSCTL_RST_EXTRST = 1
SYSCTL_RST_SYSRST = 0

after setting pin 0_3 to 1 (SW MCU reset - NVIC_SystemReset())
SYSCTL_RST_POR    = 0
SYSCTL_RST_EXTRST = 1
SYSCTL_RST_SYSRST = 1

These results show inconsistency between the documentation and HW.

Would you try to test the code on your side please ?

Thank you !

1,855件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi adam rakam,

Let me share the reply from the AE team.

After powering the board up  (HW MCU reset):
SYSCTL_RST_POR    = 1
SYSCTL_RST_EXTRST = 1
SYSCTL_RST_SYSRST = 0

Explain: Because the board have external RESET pin reset circuit, when power on, the chip experienced two kind reset: POR and  external RESET pin reset, so POR and EXTRST set. And the SYSRSTSTAT can show the source of the latest reset event. But if don't clear the other bit, the other bit still will be set. Only write a one to clear it, or POR. 

Hope this is clear.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,855件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi adam rakam,

The issue was replicated on my site, and I'll contact with the AE team about this issue later.

And thanks for your sharing.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------