Dear Sir,
Here is my code to init SWT0 on MPC5748G:
void vfnSwt0InitKey(uint32_t u32TimeoutTicks)
{
if(SWT_0.CR.B.SLK)
{
SWT_0.SR.R = 0xC520;
SWT_0.SR.R = 0xD928;
}
SWT_0.TO.R = u32TimeoutTicks;
SWT_0.CR.R = 0xFF00030B; //Allow all master access, Timeout generate reset, FRZ=1;
SWT_0.CR.B.WEN = 1;
}
The problem is that the SWT0 cannot be enabled by my code.
In the Lauterbach debugger, I can see that the SWT0_CR value is changed by my code. But just the SWT0_CR.WEN bit cannot be set to 1 by my code. I can change this WEN bit by Lauterbach debugger.
And I also tried this on SWT1. My code can config and enable SWT1 correctly.
Do you have any suggestions on this issue?
(I'm using S32DS to create MPC5748G project and compile.)
Regards,
Jason Yang
hi,
I wonder where do I can write the following command--System.Option.Watchdog ON.
In my code,I 've successfully disabled SWT,but when I config the SWT it does not work as my configurations.
After execute the following function--
void SWTInit(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;
SWT_0.CR.R = 0xFF000101;//0xFF000315;//0xFF000101;
/* Set SWT timeout */
SWT_0.TO.R = 0xFFFFFFFF;
}// end of SWTInit
I just cannot understand why SWT_0.CR is 0x ff00011b.
Hello,
this command is not related to C code, but it is related to Lauterbach debugger. This debugger uses Trace32 software which supports scripting language called Practise and this command is determined for Trace32.
Regards,
Martin
Hi,
in Lauterbach debugger write the following command:
System.Option.Watchdog ON
Now it will work.
Regards,
Martin
Thank you!
It works. I forgot the debugger's impact.