Hi, I'm using a MSP430F5510 for my master degree thesis, and I'm a bit confused about the MCLK and SMCLK. I read the datasheet part concerning the clock module lots of times, but I think it is not so clear, at least for me. I use a TI example code to set up the microcontroller at 25MHz, because I need it to work at full speed, since my application is quite heavy. This is the code:
void Clock_Init(void)
{
// Increase VCore, step by step, to support 25MHz
Clock_SetVCoreUp(0x01);
Clock_SetVCoreUp(0x02);
Clock_SetVCoreUp(0x03);
UCSCTL3 = SELREF_2; // Set DCO FLL reference = REFO
UCSCTL4 |= SELA_2; // Set ACLK = REFO
__bis_SR_register(SCG0); // Disable the FLL control loop
UCSCTL0 = 0x0000; // Set lowest possible DCOx, MODx
UCSCTL1 = DCORSEL_7; // Select DCO range 50MHz operation
UCSCTL2 = FLLD_1 + 762; // Set DCO Multiplier for 25MHz: (762 + 1) * 32768 = 25MHz
__bic_SR_register(SCG0); // Enable the FLL control loop
__delay_cycles(782000); // Settling time for DCO
// Loop until XT1, XT2 and DCO stabilizes
do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG); // Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
} while (SFRIFG1&OFIFG); // Test oscillator fault flag
}
// Set the VCore to the specified level
void Clock_SetVCoreUp(unsigned int level)
{
PMMCTL0_H = PMMPW_H; // Open PMM registers for write
SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level; // Set SVS/SVM high side new level
SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level; // Set SVM low side to new level
while ((PMMIFG & SVSMLDLYIFG) == 0); // Wait until SVM is settled
PMMIFG &= ~(SVMLVLRIFG + SVMLIFG); // Clear already set flags
PMMCTL0_L = PMMCOREV0 * level; // Set VCore to new level
if ((PMMIFG & SVMLIFG))
while ((PMMIFG & SVMLVLRIFG) == 0); // Wait till new level reached
SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level; // Set SVS/SVM low side to new level
PMMCTL0_H = 0x00; // Lock PMM registers for write access
}
In my circuit I also use the SMCLK (from port P2.2) as a clock source for another device. I read that normally the SMCLK frequency is around 1MHz. My question is: if I set up the DCO to 25MHz, will the SMCLK frequency be 25MHz or I can choose a different value? The other device needs a clock source of 1MHz or 2MHz, and I chose the SMCLK for this reason, but I never thought that the SMCLK can change with the DCO. Can I have a DCO frequency of 25MHz and a SMCLK frequency of 1MHz? If yes, how can I configure the SMCLK frequency?