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.
I have been trying to switch my MCLK signal from the DCO to the VLO for the MSP430G2553. I have a small loop that is toggling a port bit to watch the toggle frequency to verify the clock has indeed changed. Below is the subroutine code that is setting up the clock switch.
set_12khz
SET bis.b #LFXT1S_2,&BCSCTL3 ;select VLOCLK for MCLK source
bis.w #SCG1+SCG0,SR ;turn the DCO off
bis.b #SELM_3,&BCSCTL2 ;select VLOCLK for MCLK source
ret
This code matches example code provided by TI, but although I believe all the register bits are set correctly, the toggle frequency on the port does not change. The order of the instructions does not matter either (DCO can be turned off last, first or as shown).
Any ideas?
The oscillator fault flag (OFIFG) is always set at startup.
As long as it is set, MCLK is sourced from the DCO regardless of configuration, so you must clear it:
BCSCTL3 |= LFXT1S_2; /* LFXT1 = VLO */ IFG1 &= ~OFIFG; /* clear oscillator fault */ BCSCTL2 |= SELM_3; /* MCLK = LFXT1 = VLO */ __bis_SR_register(SCG1 + SCG0); /* stop DCO */
**Attention** This is a public forum