I would like to clock(MCLK and SMCLK) my MSP430F6659 at 19.2 MHz and use the internally trimmed 32768 clock as the reference input to the DCO but when I try to set this it fails. I know about the oscillator fault flag problem in the errata but even avoiding this I cannot seem to set the clock to this level. I have used both the MSP430 Ware drivers and direct registry manipulations. Is this possible and if so can you find my error?
unsigned long clockValue = 0; #define UCS_MCLK_DESIRED_FREQUENCY_IN_KHZ 19202 #define UCS_MCLK_FLLREF_RATIO 586//MCLK/FLLRef Ratio PMM_setVCore(PMM_CORE_LEVEL_3); UCS_initClockSignal(UCS_FLLREF, UCS_REFOCLK_SELECT, UCS_CLOCK_DIVIDER_1); //Set DCO FLL reference = REFO UCS_initClockSignal(UCS_ACLK,UCS_REFOCLK_SELECT,UCS_CLOCK_DIVIDER_1); //Set ACLK = REFO UCS_initFLLSettle(UCS_MCLK_DESIRED_FREQUENCY_IN_KHZ,UCS_MCLK_FLLREF_RATIO); //Set Ratio and Desired MCLK Frequency and initialize DCO do{ // --------------------------- Loop until XT1,XT2 & DCO fault flag is cleared ------------------------------ UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG); // STEP 2.1: Clear XT2,XT1,DCO fault flags SFRIFG1 &= ~OFIFG; // STEP 2.2: Clear oscillator fault flag } while (SFRIFG1&OFIFG); // STEP 1.3: Test if oscillator fault flag has re-engaged SFR_clearInterrupt(SFR_OSCILLATOR_FAULT_INTERRUPT); // Enable global oscillator fault flag // SFR_enableInterrupt(SFR_OSCILLATOR_FAULT_INTERRUPT); clockValue = UCS_getSMCLK(); clockValue = UCS_getMCLK(); clockValue = UCS_getACLK();
Although clock value is reported as 19.2 the actual clock value produced is much lower.