Other Parts Discussed in Thread: MSP430F2618
Hi folks,
I've got a problem selecting VLOCLK or LFXT1CLK as source for MCLK. Selecting VLOCLK and LFXT1CLK for ACLK works just fine, but as soon as i select them for MCLK, the msp430 uses the DCO. I also tried to turn the DCO off, but then it also didn't use the selected source, as proposed in the thread "Can MSP430F2618 LFXT1 use 16MHz crystal for MCLK?" but I didn't worked out so far. Hope someone can help me here.
#include "msp430x26x.h"
void main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 = XT2OFF + XTS+RSEL0+RSEL1+RSEL2+DIVA_0;
BCSCTL3 = LFXT1S_3 + XCAP_0;
// BCSCTL1=XT2OFF+XTS+RSEL0+RSEL1+RSEL2+DIVA_0;
// BCSCTL3=LFXT1S_2+XCAP_0;
// Wait for xtal to stabilize
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
__bis_SR_register(SCG1 + SCG0); //Disable DCO
for (i = 0x47FF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?
BCSCTL2 |= SELM_2;
// PORT INIT
P1DIR = 0xFF; // All P1.x outputs
P2DIR = 0xFF; // All P2.x outputs
P3DIR = 0xFF; // All P3.x outputs
P4DIR = 0xFF; // All P4.x outputs
//P5DIR = 0xFF; // All P5.x outputs
P5DIR |= 0x78; // P5.6,5,4,3 outputs
P5SEL |= 0x70; // P5.6,5,4 options
P6DIR = 0xFF; // All P6.x outputs
P1OUT = 0x00; // All P1.x reset
P2OUT = 0x00; // All P2.x reset
P3OUT = 0x00; // All P3.x reset
P4OUT = 0x00; // All P4.x reset
P6OUT = 0x00; // All P6.x reset
while(1)
{
P1OUT = 0x00;
P1OUT = 0x01;
// __bis_SR_register(LPM4_bits + GIE); // Enter LPM3, enable interrupts
}
}