First off: I'm brand new to microcontroller development, so please forgive me for the simple question. I'm trying to learn for my FIRST robotics team so we can use the MSP430 to handle some extra sensors.
I'm working on understanding/configuring the Unified Clock System. I want it to run on the 25 MHz setting. I've been reading the family guide and device specific datasheet. I think I have a basic understanding. My code is below:
/* * Objective: have SMCLK run at ~25 MHz for driving an SPI device */ WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer __bis_SR_register(SCG0); //Disable FLL UCSCTL0 = DCO0+DCO1+DCO2+DCO3+DCO4 ; //DCO 31 bit and MOD bit 0 [THIS IS NOT WORKING] UCSCTL1 = DCORSEL_4; //Select frequency range on http://www.ti.com/lit/ds/symlink/msp430f5529.pdf page 31 UCSCTL2 = 0x000; //Select no loop divider UCSCTL3 |= SELREF_2; //Set FLL reference to REFOCLK (only internal) UCSCTL4 |= SELS__DCOCLK; //Select SMCLK clock source to be DCOCLK P1DIR |= (BIT0 + BIT2); //irrelevant P2DIR |= BIT2; //Set P2.2 as out direction to monitor clock P2SEL |= BIT2; //Select P2.2 as SMCLK output defined in http://www.ti.com/lit/ds/symlink/msp430f5529.pdf pg 84 __bic_SR_register(SCG0); //Enable FLL
However, this isn't working well, resulting in a very strange oscilliscope output for two reasons:
The output's waveform is not how I usually see the clock output. Usually I see something resembling a sin wave, now I see something very different.
The waveform shows the clock to be running at ~2 MHz not the desired 25.
Ignore the green line.