Team,
I'm posting on behalf of my customer. He is working with legacy 'F149 code from an operational product and is having trouble running the same code on a 'F149 in our TS430PM64 eval board with IAR 7.10.3. Could you review the code below to see if it makes sense? Is there a better way to do this?
Thanks,
Tom
"We are stuck in our SwitchTo8MhzClock function, shown below.
1) Does this legacy code look good to get the clock setup?
2) Any ideas why this would not work?
2) Since the WDT is getting continuously reset, why are we ending up in reset?
- i.e. How can I determine the cause of the reset?"
void SwitchTo8MhzClock(void)
{
int count;
//*************************** switch to 8MHz clock*******************************
BCSCTL1 |= (XT2OFF + XTS);
_BIC_SR(OSCOFF); // for F149 turn off XT1 so the oscfault stuff doesn't get confused
do
{
IFG1&=~OFIFG; //Reset osc. fault flag
for (count=1; count<0xfff; count++)
{
api_WatchdogReset();
}
}while(OFIFG & IFG1); //Loop as long as osc. fault flag remains active
IFG1&=~OFIFG; //Reset osc. fault flag again
BCSCTL2 = SELM1 + SELM0; //MCLK 8MHz ext xtal
DCOCTL = 0; //run the DCO as slow as we can for power savings mode
//mclk = 8MHz //aclk = 8MHz //smclk = DCO
}