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.

Switch from DCO to VLO clock not working on MSP430G2553

Other Parts Discussed in Thread: MSP430G2553

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?

  • Hi Richard,

    I am also using the same mcu MSP430G2553. I am also facing the same problem which you mentioned above (Switching MCLK from DCO to VLO).

    Did you find any work around for this ?

    Regards,
    Ashok
  • 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 */
  • Hi Richard,

    Here, is the configuration which may work for you.


    void switchClockDCOToVLO(void)
    {
    BCSCTL3 = LFXT1S_2; // Select VLO as clock
    IFG1 &= ~OFIFG; // Clear oscillator fault interrupt flag
    _NOP(); // Wait for atleast 50 usec or execute 1 instruction(83.3 usec) at 12 KHz.
    _NOP();
    BCSCTL2 = SELM_3; // Select MCLK source as VLO Clock with divider 1
    BCSCTL1 = (XT2OFF | DIVA_0); // ACLK = VLO/1 = 12 KHz
    }


    Regards,
    Ashok
  • The comment on the NOPs is wrong because the CPU clock has not yet been switched to VLO.

**Attention** This is a public forum