This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F149: Setting 8MHz Clock, but WDT resetting

Part Number: MSP430F149


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

}

  • Hello Tom,

    I'm not sure what your customer is doing here, but this is not correct as described. If the watchdog is resetting their device, then they are not "feeding the dog" in time. The Watchdog timer can only be run from ACLK or SMCLK. By default it runs on SMCLK for this device.

    Also, ACLK cannot be 8MHz. ACLK is only clocked by LFXTAL and there is no backup or fail safe as there is in newer MSP430s. Also their is no oscillator fault circuit for the LFXtal on this device. I'm not sure exactly what's happening, but my guess would be that the watchdog is being clocked faster than expected via SMCLK and thus timing out. I would recommend looking at our example code for the MSP430F149 found in TI Resource Explorer as it has examples for both changing the DCO and/or MCLK to XT2 and using the watchdog timer in various modes.
  • Hello Tom,

    Did the above solve your customer's issue? since there has been no response, I will be closing this thread soon.

    Also for future reference, when posting code to the forum, please use the "Use rich formatting" link at the bottom right of the reply box. Once in this mode and you are ready to post your code, click the </> box for the code formatter. I have already edited your response to do this as well.

**Attention** This is a public forum