Diferenciating PORST pin and power on reset for watchdog test

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

cross mob
User11706
Level 2
Level 2
Hello,

We are using an XMC4500 in a safety critical application.
We have an external Watchdog connected to PORST pin which will pull PORST down
and perform a PORST reset if we do not service it periodically.

So far so good...
Now we need to test the Watchdog hardware at power on to make sure it works.

To do that, we store a flag in some non volatile RAM, I was hopping to use GPR registers.
But they are cleared by PORST.
It is therefore impossible to differentiate a PORST from a Watchdog test puling down PORST pin.

Does someone suggest me another Non volatile memory area that would persist to PORST ?
ABM?
Hibernate mode registers ?
Has someone some experience or an idea on how to test an external WD circuit.

Thanks a lot for your suggestions or ideas.

Jorge
0 Likes
2 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

You cannot differentiate them because both events, power on reset and porst going down, triggers a PORST reset and the GPRs are reset by PORST
A solution could be to connect the external WDT output to another pin and react on the rising edge or falling edge depending on your configuration executing a SystemReset() in the ISR of the external pin IRQ using the ERUs.
Additionally maybe using something similar to the program below if VBAT is not connected to VDDP and uses its own supply.
After the first power on reset the hibernate domain will be enabled. If you the external WDT pulls the PORST pin down, a PORST will happen but the Hibernate domain is kept enabled. Therefore we will write to the retention memory. This will be detected later on switching the LED on

int main(void)
{
XMC_GPIO_SetOutputHigh(LED1);
XMC_GPIO_SetMode(LED1, XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN);

if (XMC_SCU_HIB_IsHibernateDomainEnabled() == true)
{
if ((XMC_SCU_RESET_GetDeviceResetReason() & XMC_SCU_RESET_REASON_PORST) != 0)
{
XMC_SCU_WriteToRetentionMemory(0, 0xDEADBEEF);
}
}
else
{
XMC_SCU_HIB_EnableHibernateDomain();
XMC_SCU_WriteToRetentionMemory(0, 0);
}

XMC_SCU_RESET_ClearDeviceResetReason();

if (XMC_SCU_ReadFromRetentionMemory(0) == 0xDEADBEEF)
{
// PORST reset
XMC_GPIO_SetOutputLow(LED1);
XMC_SCU_WriteToRetentionMemory(0, 0);
}

/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{

}
}


Regards,
Jesus
0 Likes
User11706
Level 2
Level 2
Hello Jesus,

Good suggestion. In our custom board, the VBat is connected to 3V3, so it does not loose supply during reset.
So I finally implemented something similar to what you suggest,
it is a bit slow, but on power on we don't care much.
And it works just fine !

🙂

Thank you!
Jorge
0 Likes