All times are UTC - 5 hours [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Can MSP430F2418 Change the Clock Source of ACLK
PostPosted: June 1st, 2017, 5:35 
Offline

Banned User

Joined: April 13th, 2017, 3:10
Posts: 2
Location: china
Good day,
The MCU is MSP430F2418 which I bought from site: [spam link removed] and at the beginnning, clock source is serve as VLO in MCU inside. I want to change the clock source of ACLK to be crystal oscillator--32768 outside when operating. The code is given below:
Code:
#include "msp430.h"
void main(void)
{
  unsigned long i=0xffff;
  _BIC_SR(0xFFFF);                      //reset anything in SR, inline function.
  
  WDTCTL=WDTPW+WDTHOLD;                 //colse watchdog timer  
  BCSCTL1&=~XT2OFF;                     /open XT2
  BCSCTL2 |= (SELM_2+DIVM_2+SELS);        //MCLK、SMCLK choose xt2(5MHz,so MCLK=1.25MHz,SMCLK=5MHz
  BCSCTL3 |=  (XT2S_2+LFXT1S_2+XCAP_1);                  //6pF capacitor  IFG1 &= ~OFIFG;
  
  P5SEL |= BIT4+BIT6;
  P5DIR |= BIT4+BIT6;
  P1SEL |= BIT4;
  P1DIR |= BIT4;
  
  IFG1&=~(WDTIFG+OFIFG+NMIIFG+PORIFG+RSTIFG);  //Interrupt flag reset
  FCTL3=FWKEY;                          //ACCVIFG reset
  IE1|=OFIE+NMIIE+ACCVIE;               //Interrupt initialization Settings
  
  while(i)
  {
    i--;
  }
  BCSCTL3 = (XT2S_2+LFXT1S_0+XCAP_1);
  
  do
  {
    IFG1 &= ~OFIFG;                      // Clear OSCFault flag
    for (i = 0xFF; i > 0; i--);          // Time for flag to set
  }
  while (IFG1 & OFIFG);                 // OSCFault flag still set  
  
  while(1);
}

The programs,However, always lies in these code “ while(i) { i--;}”. When I deleted the sentence “BCSCTL3 = (XT2S_2+LFXT1S_0+XCAP_1);”, it can operate normally again ! ! ! Why?

Best regards~


Top
 Profile  
 
 Post subject: Re: Can MSP430F2418 Change the Clock Source of ACLK
PostPosted: June 1st, 2017, 10:47 
Offline

Joined: March 19th, 2015, 15:01
Posts: 1387
Location: isreal
I dont know what this has to do with HDDs (I really dont care)
And I really dont know who has written the code
but the code makes no sense "at all"


Top
 Profile  
 
 Post subject: Re: Can MSP430F2418 Change the Clock Source of ACLK
PostPosted: June 1st, 2017, 14:28 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 15461
Location: Australia
jermy wrote:
I dont know what this has to do with HDDs (I really dont care)

The MSP430 is used as a power controller/sequencer in some SSDs.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: Can MSP430F2418 Change the Clock Source of ACLK
PostPosted: June 2nd, 2017, 12:01 
Offline

Joined: June 2nd, 2017, 11:05
Posts: 1
Location: Earth
But the F2418 would not make sense in this application.

This is an attempt at https://xkcd.com/810/ .


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group