Part Number:MSP-EXP430G2
Tool/software: Code Composer Studio
Hi all,
I have been trying to source SMCLK and MCLK from the DCO, with dividers in a MSP430G2553 launchpad. The code is as below. The following function is the only content of the program, in main. I have commented all of the rest out.
void basic_clock_system_init_125khz_mclk_smclk_aclk(void) { DCOCTL = 0; // Select lowest DCOx and MODx settings BCSCTL1 = CALBC1_1MHZ; // Set range DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation */ BCSCTL2 |= SELS | DIVS_3 | SELM_0 | DIVM_3; // SMCLK & MCLK /8 P1DIR |= BIT4; P1SEL |= BIT4; // Summary: 125kHz MCLK SMCLK }
The waveform I observed in the oscilloscope is quite inaccurate. Please see below, the yellow plot.
If I take the dividers off, and just set the SELS and SELM_0, I still get an inaccurate waveform. Please see below.
NOTE: The moment I remove the line "BCSCTL2 |= SELS | DIVS_3 | SELM_0 | DIVM_3;", I am able to get a decently accurate 1MHz waveform. However, as I am trying to source 125kHz (1MHz / 8) on MCLK and SMCLK, i need that line.
Could someone point out what i am doing wrong please?
Thank you.
Kind regards,
Guyan