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.

MSP430F47187 XT2 MCU SETTING

HI  everyone

i want seting mcu

MCLK=XT2=16M 

SMCK=XT2=16M

ACLK=32768KHZ

my code

#include <msp430x471x7.h>

int main( void )
{

volatile unsigned int i;

WDTCTL = WDTPW + WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP11PF;; // Set load capacitance

FLL_CTL1 &= ~XT2OFF; // Turn on XT2

// Loop until 32kHz crystal stabilizes
do
{
IFG1 &= ~OFIFG; // Clear oscillator fault flag
for (i = 50000; i; i--); // Delay
}
while (IFG1 & OFIFG); // Test osc fault flag

// Select SMCLK source as XT2CLK

FLL_CTL1 |= (SELS + SELM1);

FLL_CTL2 |= XT2S_2;
P1DIR = BIT1+BIT4+BIT5; // Set P1.1,4,5 as outputs
P1SEL = BIT1+BIT4+BIT5; // Select P1.1,4,5 as clocks

P4DIR|=BIT0;

while(1)
{
P4OUT^=BIT0;
}
}

but i have some question

1.Meaning out of the range of measurement XT2 VP-P must be between 3.0V-3.6V??? 

2.i measure LED TOGGLE FREQ 

why the Frequency Is not equal to 8M or Approaching 8M

why is 1.33M

  • jack li2 said:
    why the Frequency Is not equal to 8M or Approaching 8M

    Because toggling the port pin requires reading the instruction, reading the port address, reading the current port value and writing it back. And then a jump to repeat the isntruciton.

    So each toggle takes 6 MCLK cycles or so and the resulting frequency is 1.33MHz or so (assuming my count of clock cycles is correct).
    For other port pins (XOR value 16 and above), the constant generator cannot be used and one more clock cycle is needed to read the value before XORing it.

    jack li2 said:
    1.Meaning out of the range of measurement XT2 VP-P must be between 3.0V-3.6V??? 

    No, the MSPs supply voltage has to be. (below 3V supply, the oscillator circuit won't be fast enough to run with >12MHz)

  • Jens-Michael Gross said:

    why the Frequency Is not equal to 8M or Approaching 8M

    Because toggling the port pin requires reading the instruction, reading the port address, reading the current port value and writing it back. And then a jump to repeat the isntruciton.

    So each toggle takes 6 MCLK cycles or so and the resulting frequency is 1.33MHz or so (assuming my count of clock cycles is correct).
    For other port pins (XOR value 16 and above), the constant generator cannot be used and one more clock cycle is needed to read the value before XORing it.

    jack li2 said:
    1.Meaning out of the range of measurement XT2 VP-P must be between 3.0V-3.6V??? 

    No, the MSPs supply voltage has to be. (below 3V supply, the oscillator circuit won't be fast enough to run with >12MHz)

    [/quote]

    Thank you for your answer~~

**Attention** This is a public forum