AnsweredAssumed Answered

how to init the watchdog for MPC5748G

Question asked by Larry Li on Jun 6, 2016
Latest reply on Jun 6, 2016 by Martin Kovar

Hi everyone,


I'm trying to devolopment the bootloader for MPC5748G, we meet a problme about the watchdog.


We have used the default project configuration of S32 V1.0 for power, and we changes nothing for the interrupt vector table.

Then we used the below code to init the watchdog after call the xcptn_xmpl. When we want to write the specifed value into SWT, err will occurs. Acturally, both read and write of the SWT register will cause the err. The CPU will go to IVOR1_Vector. We have checked that the pointer to the SWT is correct. SWT_0 is start from 0xFC050000 and the SWT_0.SR is 0xFC050010.


Can anyone know how to init the watchdog or help me to solve the problem?



void Wdg_Init(void)


while(MC_ME.GS.B.S_SIRCON != 1U)


/* SWT must be configured only if the 128 KHz internal

        RC oscillator is providing a stable clock */



SWT_0.SR.R = 0xC520U;       /* error occurs here, CPU will go to IVOR1_Vector.*/

SWT_0.SR.R = 0xD928U;      


/* WDG can only be serviced with fixed sequence */

SWT_0.CR.B.SMD = 0U;


/* Generate a reset on a time-out */

SWT_0.CR.B.ITR = 0U;


    /* Invalid access to the SWT causes a system reset */

SWT_0.CR.B.RIA = 1U;


/* SWT continues to run in stop mode */

SWT_0.CR.B.FRZ = 1U;


/* SWT continues to run in stop mode */

SWT_0.CR.B.STP = 0U;


/* Set time-out clock cycles */



/* SWT enabled */

SWT_0.CR.B.WEN = 1U;


/* Make the WDG enter soft lock mode */

SWT_0.CR.B.SLK = 1U;