Hi,Dear sir
I want to reset the MCU mc9s12xep100 by watchdog way.
My reset vector address is 0xC000 with the name _Startup() function.
_Startup()
{
.....
main();
}
main()
{
/* PLLCTL: PCE=0 */
clrReg8Bits(PLLCTL, 2);
/* COPCTL: WCOP=0,RSBCK=0,CR2=1,CR1=1,CR0=1 */
clrSetReg8Bits(COPCTL, 192, 7);
/* CRGINT: LOCKIE=0,SCMIE=0 */
clrReg8Bits(CRGINT, 18);
/* VREGCTRL: LVIE=0 */
clrReg8Bits(VREGCTRL, 2);
/* ECLKCTL: NECLK=0,NCLKX2=1,DIV16=0,EDIV4=0,EDIV3=0,EDIV2=0,EDIV1=0,EDIV0=0 */
setReg8(ECLKCTL, 64);
/* System clock initialization */
/* CLKSEL: PLLSEL=0,PSTP=0,XCLKS=0,??=0,PLLWAI=0,??=0,RTIWAI=0,COPWAI=0 */
setReg8(CLKSEL, 0); /* Select clock source from XTAL and set bits in CLKSEL reg. */
/* PLLCTL: CME=1,PLLON=0,FM1=0,FM0=0,FSTWKP=0,PRE=0,PCE=0,SCME=1 */
setReg8(PLLCTL, 129); /* Disable the PLL */
/* VREGHTCL: ??=0,??=0,VSEL=0,VAE=1,HTEN=0,HTDS=0,HTIE=0,HTIF=0 */
setReg8(VREGHTCL, 16);
while(1);//dead loop for reset.
}
I use BDM to run this code.I beat Start button in Ture-Time ... Debugger,and then set the breakpointer at 0xC000.But I found MCU can't reset since that it never stop at 0xc000.And after about some second,PC run at 0x524d address with command window hinting "ILLEGAL_BP" information.
I try to run it in normal mode,and find it should reset normally.
I have 2 qestion:1.Why the cpu can't reset in BDM mode?
2.Why it stop at 0x524D?