Hello!
I have problem with MCLK and SMCLK. According to the User's Guide the MCLK and SMCLK should have separate dividers, but for some reason MSP430F6733 does not seem to behave that way.
The problem here is that I want to drop MCLK frequency in order to cut some CPU current consumption and keep the SMCLK at maximum 25MHz to keep communications running smoothly at high frequency. The problem is that for some reason the MCU seem to force SMCLK <= MCLK rule. According to the datasheets and user's guides this kind of dependency shouldn't exist. Both MCLK and SMCLK are sourced from the 25MHz DCO.
I have configured a TA0 to take clock from SMCLK and use it to toggle a LED once a second when SMCLK = 25MHz. When DIVS = 001 and DIVM = 000, the timer toggles the LED in two second interval, as expected since the SMCLK is halved. But if DIVS = 000 and DIVM = 001 the timer toggles the LED in two second interval, even the SMCLK should be running at 25MHz and only the CPU clock should be halved. Why it behaves in this way?
The clock initialisation code is following:
void vMSP430_CoreInit(void)
{
StopWatchdog;
DisableInterrupts;
//Set VCore = 3 for 25MHz clock
PMM_setVCore(PMM_BASE,
PMM_CORE_LEVEL_3
);
//Start the XT1 low frequency 32Khz oscillator with no timeout.
//In case of failure, code hangs here.
//For time-out instead of code hang use UCS_LFXT1StartWithTimeout()
UCS_LFXT1Start(UCS_BASE,
UCS_XT1_DRIVE3,
UCS_XCAP_3 //12.0 pF + parasitic (ideal total is 12.5 pF)
);
//Set DCO FLL reference = XT1
UCS_clockSignalInit(
UCS_BASE,
UCS_FLLREF,
UCS_XT1CLK_SELECT,
UCS_CLOCK_DIVIDER_2
);
//MCLK is initialized by this function.
//Set Ratio and Desired MCLK Frequency and initialize DCO
//If the frequency is greater than 16 MHz, the function sets the MCLK and SMCLK source to the undivided DCO frequency.
//Otherwise, the function sets the MCLK and SMCLK source to the DCOCLKDIV frequency.
UCS_initFLLSettle(
UCS_BASE,
UCS_MCLK_DESIRED_FREQUENCY_IN_KHZ,
UCS_MCLK_FLLREF_RATIO
);
//MCLK = DCO. (25Mhz)
UCS_clockSignalInit(
UCS_BASE,
UCS_MCLK,
UCS_DCOCLK_SELECT,
UCS_CLOCK_DIVIDER_2
);
//ACLK = DCO. (25Mhz)
UCS_clockSignalInit(
UCS_BASE,
UCS_ACLK,
UCS_DCOCLK_SELECT,
UCS_CLOCK_DIVIDER_1
);
//SMCLK = DCO. (25Mhz)
UCS_clockSignalInit(
UCS_BASE,
UCS_SMCLK,
UCS_DCOCLK_SELECT,
UCS_CLOCK_DIVIDER_1
);
return;
}
-Juho L