cancel
Showing results for 
Search instead for 
Did you mean: 

SPC56EL60L3 - Software Watchdog Timer Reset

alessandro2
Associate III
Posted on February 19, 2017 at 16:07

Hello Everyone,

woking with SPC56EL60L3, I noticed that when the device gets reset by the software watchdog timer, the behaviour is different than I expected. I was expecting the application to be restarted, but I notice the application does not start running, until the next power-on reset.

Looking at the device documentation, I found the followong sentence (page 1292, RM0032):

'If a software watchdog timeout event occurs, then the chip will always enter SAFE mode immediately after reset exit.'

So I Iooked at the startup code and I found this (file clock.c, row 131, function spc_clock_init() :(

/* The system must be in DRUN mode on entry, if this is not the case then

 

it is considered a serious anomaly.*/

 

if (ME.GS.B.S_CURRENT_MODE != (uint32_t)SPC5_RUNMODE_DRUN) {

 

SPC5_CLOCK_FAILURE_HOOK();

 

}

 

 

It looks like the current run mode is checked against the expected run mode (which is DRUN) and if

it's different, the SPC5_CLOCK_FAILURE_HOOK() is invoked, which is mapped to irqSysHalt() (basically an

endless loop). This could explain why my application isnot starting after the system being reset by the SWT.

The question is: what if I need my application to restart (without having to cycle the power), after a SWT reset?

Can I just change the above code to include SAFE_MODE as a valid initial state (so that the function goes ahead)?

Is there anything else I need to do?

Thank you.

Regards

Alessandro

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee
Posted on February 20, 2017 at 10:26

Hello Alessandro ,

Yes , if the watchdog timer occured .. the original code is way to solve the SWT issue linked to ainfinite loop.

If you want to restart your software after SWT , you have to patch this file like below

you can patch RLA the clock init.

/* The system must be in DRUN mode on entry, if this is not the case then
 it is considered a serious anomaly.*/
 if ((ME.GS.B.S_CURRENT_MODE != (uint32_t)SPC5_RUNMODE_DRUN) && (ME.GS.B.S_CURRENT_MODE != (uint32_t)SPC5_RUNMODE_SAFE)) {
 SPC5_CLOCK_FAILURE_HOOK();
 }�?�?�?�?�?

and respect the following states

0690X00000606LTQAY.png

Best regards

Erwan

View solution in original post

2 REPLIES 2
Erwan YVIN
ST Employee
Posted on February 20, 2017 at 10:26

Hello Alessandro ,

Yes , if the watchdog timer occured .. the original code is way to solve the SWT issue linked to ainfinite loop.

If you want to restart your software after SWT , you have to patch this file like below

you can patch RLA the clock init.

/* The system must be in DRUN mode on entry, if this is not the case then
 it is considered a serious anomaly.*/
 if ((ME.GS.B.S_CURRENT_MODE != (uint32_t)SPC5_RUNMODE_DRUN) && (ME.GS.B.S_CURRENT_MODE != (uint32_t)SPC5_RUNMODE_SAFE)) {
 SPC5_CLOCK_FAILURE_HOOK();
 }�?�?�?�?�?

and respect the following states

0690X00000606LTQAY.png

Best regards

Erwan

Posted on February 21, 2017 at 16:35

OK, great. 

That worked.

Thank you.

Alessandro