need help about SWT

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

need help about SWT

863 Views
congtaoxu
Contributor II

Hi,

  Now,I have some questions to ask.

  first,how to periodic execution of a watchdog servicing operation?Is there need another  timer to write somethhing  into SWT_0.SR.R regular?

 second,now,the SWT could produce a reste request,how can I make the syetem reset?

that's all.
                                                                                                                        tao

Labels (1)
0 Kudos
3 Replies

652 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

1. I would recommend to read:

Introduction to Watchdog Timers | Embedded 

I found this as a first link on google - nice point to start...

2. How to reset the device using SWT:

pastedImage_2.png

Regards,

Lukas

0 Kudos

652 Views
congtaoxu
Contributor II

Hi,

Thank you for your reply.

Now,first,I use one timer to periodic execution of a watchdog servicing operation.Here are my code:

while(1)
    {
        while(PIT_0.TIMER[0].TFLG.B.TIF==1)
        {
         PIT_0.TIMER[0].TFLG.B.TIF=1;    
         PIT_0.TIMER[0].TCTRL.R=0;      
         SWT_0_service();
         PIT_0.TIMER[0].LDVAL.R=6650000-1;
         PIT_0.TIMER[0].TCTRL.R=1;     
        }

Second,SWT reset is reported via FCCU into RGM(SWT0->FCCU/NCF[14]->FOSU->RGM->reset)?Is there a way reset the system by the SWT_0.IR.B.TIF directly?

pastedImage_2.png

Here are some config:

    about SWT:

static void SWT_Init(void)
{
    /* Provide a Key to unlock SWT configuraiton registers */
    SWT_0.SR.R = 0xC520;
    SWT_0.SR.R = 0xD928;

    /* Wait for solf-lock bit */
    while (SWT_0.CR.B.SLK == 0x1);
    /* Enable SWT_0 */
    SWT_0.CR.B.WEN = 0x1;
    /* Set SWT timeout */
    SWT_0.TO.R = 0x000FFFFF;   //2^20-1=1048575
    SWT_0.CR.R = 0xFF000101;   //MAP0-7,SMD=00;RIA=1;WEN=1;
}

about FCCU:

void FCCU_Config()    
{
    FCCU_read_fault();
    FCCU_clear_faults();

    FCCU.TRANS_LOCK.B.TRANSKEY = 0xBC;    //0xBC unlock,other lock;
    FCCU.CTRLK.R = 0x913756AF;            //Unlock OP1,other do nothing
    FCCU.CTRL.R = 0x1;                    //Operation1   Put FCCU in Configuration state.
    while (FCCU.CTRL.B.OPS != 0x3);

    FCCU.NCF_E[0].R=0xFFFFFFFF;             //enable all channel
    FCCU.NCFS_CFG[0].R = 0x10000000;     //short reset
    FCCU.NCF_TOE[0].R=0xFFFFFFFF;        //moves into the ALARM state
    FCCU.IRQ_ALARM_EN[0].R=0xFFFFFFFF;      //Alarm is enabled for error source x
    FCCU.NCF_TO .R=0xFFFF;               //Timeout = (TO) × T RC16MHz 4.96ms<Tfosu
    FCCU.CTRLK.R = 0x825A132B;        //key for OP2
    FCCU.CTRL.R = 0x2;            //set the OP2 - set up FCCU into the NORMAL mode
    while (FCCU.CTRL.B.OPS != 0x3);    //operational status successful
}

about RGM:
void RGM_Init()
{
      RGM.DES.B.F_FFRR=0;     //No FCCU failure to react reset event has occurred
      RGM.DES.B.F_SOFT_DEST=0;//No software ‘destructive’ reset event has occurred
      RGM.DERD.B.D_FFRR=0;// FCCU failure to react reset event triggers a reset sequence
      RGM.DERD.B.D_SOFT_DEST=0;//A software ‘destructive’ reset triggers a reset sequence
}

Are there some wrong?How can I config the FOSU if necessary.

Regards,

Tao

0 Kudos

652 Views
medhedibasly
Contributor III

i'm working on the same subject.

I configured my FCCU to do a short reset whet SWT imeout is detected.

i enable the SWT and write the Timeout Register but the SW is running ok without servicing the SWT, i'm supposed to have a reset when the the SWT counter reach the Timeout.

is ther anothe rconfig that i didn't do.

Regards,

Hedi

0 Kudos