Switch to full style
Tools for hard drive diagnostics, repair, and data recovery
Topic locked

Can MSP430F2418 Change the Clock Source of ACLK

June 1st, 2017, 5:35

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~

Re: Can MSP430F2418 Change the Clock Source of ACLK

June 1st, 2017, 10:47

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"

Re: Can MSP430F2418 Change the Clock Source of ACLK

June 1st, 2017, 14:28

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.

Re: Can MSP430F2418 Change the Clock Source of ACLK

June 2nd, 2017, 12:01

But the F2418 would not make sense in this application.

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