2017-02-19 07:07 AM
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.
RegardsAlessandroSolved! Go to Solution.
2017-02-20 01:26 AM
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
Best regards
Erwan
2017-02-20 01:26 AM
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
Best regards
Erwan
2017-02-21 08:35 AM
OK, great.
That worked.
Thank you.
Alessandro