Hi,
I am using MPC5748G, Working in Bootloader project and using Lauterbach debugger. I am facing an issue as when i connects through debugger, i can see bootloader is working but when i remove the debugger, and notices as nothing startup. itseems like continous reset, i assume that will be watchdog. How can i disable the watchdog. ?
i added my code snippet for disabling the watchdog.
SWT_SR = (uint32)0x0000C520;
SWT_SR = (uint32)0x0000D928; /* clear softlockbit */
SWT_CR = (uint32)0x80000102;
but still having the issue.
Do i need to disbale anything else?
Regards
Hussain U
Hi,
Yes, it is really SWT. Debugger by default disable SWT, that's why it is working with debugger connected.
Once you enable SWT in your debug tool your code will fail when SWT timeout.
Default timeout is 20ms. After 15 consecutive resets you will get reset escalation and permanent reset until power on reset is triggered.
So to disable SWT in your main function or later has no effect. As the time required to get into main is usually longer than 20ms.
Do it in your startup code. Assembly at very start of micro.
This will work for you.
regards,
Peter
HI Pete,
Yes it works now, i added the below code :smileyhappy:
e_lis r4, 0xFC05
e_or2i r4, 0x0000
e_li r3, 0xC520
e_stw r3, 0x10(r4)
e_li r3, 0xD928
e_stw r3, 0x10(r4)
e_lis r3, 0x7F00
e_or2i r3, 0x0102
e_stw r3, 0(r4)
Thanks Peter :smileyhappy:
Regards
Hussain U