Yuri Nagornii

SPC570S50E1 problem with SWT.

Discussion created by Yuri Nagornii on May 15, 2017
Latest reply on Jun 8, 2017 by Erwan Y

Hi all.

I have a problem with SPC570S50E1.

 

SWT has been gonfigure with:

 

void swt_init(bool status)

{ INTC_PSR (SPC5_SWT_NUMBER) = INTC_PSR_ENABLE(INTC_PSR_CORE0, SPC5_SWT_PRIORITY); SWT_2.TO.R = 0x0186A000;                /* 1.6s / 16000000Hz = 256000000 = 0x0186A000 */

SWT_2.CR.B.SMD = 0;                         /* Fixed Service Sequence, the watchdog is serviced by writing */

                                                               /* the fixed sequence 0xA602, 0xB480 to the SWT_SR */

SWT_2.CR.B.RIA = true;                      /* Invalid access to the SWT causes a system reset */

SWT_2.CR.B.ITR = false;                      /* Interrupt Then Reset disabled */

}

 

In main loop each every 0.8s called procedure swt_reset();

 

void swt_reset(void)
{
static systime_t CurrentSysTime, ExtWdtPeriod;

CurrentSysTime = sysTimeGetTimeMilliseconds();
   if (CurrentSysTime >= ExtWdtPeriod)
      {
      if (SwtEnabled)
         {
         SWT_2.SR.R = 0x0000A602; /* fixed service sequence mode */
         SWT_2.SR.R = 0x0000B480;
         }

      ExtWdtPeriod = CurrentSysTime + 800; /* 800 ms - half of SWT period */
      }
}

 

And I have an interrupt handle also.

 

IRQ_HANDLER(SPC5_SWT_HANDLER)
{
   IRQ_PROLOGUE();


   SWT_2.IR.B.TIF = 1; /* Clear Interrupt flag*/

   IRQ_EPILOGUE();
}

 

I use the SPC5-UDESTK debugger and all work good.
But if I have started application without debugger it not work.
I commented swt_init(true), also application is work good without debugger.
Pls, help me what I do incorrectly.

 

Best regards, Yuri/

Outcomes