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.

SMCLK frequency incorrect with USB disconnected on MSP430F6638

I'm having a strange problem that I don't understand.

I have a board that is using the prerelease X430F6638, and my program includes sources from MSP430_USB_Developers_Package_3_0_0_0 for a USB HID interface.

Init_FLL() has this call to configure SMCLK:
SELECT_MCLK_SMCLK(SELM__DCOCLKDIV + SELS__DCOCLKDIV);

I wanted to use XT2/2 for my SMCLK instead, so I added the following lines just after the call to Init_FLL():
SELECT_SMCLK(SELS__XT2CLK);
SMCLK_DIV(2);

My board has 24 MHz for XT2, so I expect XT2/2 = 12 MHz for my SMCLK.

If I start my program with the USB cable connected, everything works ok.  I am using SMCLK to feed the baud rate generator for a 56kbps UART interface.  My UART init includes this line:
// Select SMCLK for the BRCLK source clock.
UCA1CTL1 |= UCSSEL__SMCLK;

Peripherals using SMCLK all seem to work great with the USB cable connected.

However, if I start my program with the USB cable disconnected, the baud rate of the UART seems to slow down.  I assume this means that the SMCLK has also slowed.

When I reconnect the USB cable, the baud rate suddenly snaps to the correct frequency.  Then if I disconnect the USB cable without restarting my program, the baud rate stays correct.

Note that I've tried the USB_DISABLE_XT_SUSPEND value of both 0 and 1 in descriptors.h, and this didn't seem to make a difference.

When SMCLK is using XT2, should I expect a change in frequency when the USB cable is disconnected?  I assumed that if I've selected XT2 for my SMCLK with some divider, it wouldn't matter what the FLL or MCLK are doing.  The USC block diagram shows the path from XT2 to SMCLK is independent of the other clocks, but maybe I'm missing something.

Any advice is appreciated.

  • are you calling Init_FLL() in an initialization routine (outside of any USB stuff)? what is the reference to the FLL? Init_FLL() had problems in the older core library revisions. They just updated those and the USB_API. You may want to try updating these first and see if the problem persists.

**Attention** This is a public forum