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.

MSP430F67791A: System Frequency issue

Part Number: MSP430F67791A


Hello,

I have configured the Controller for Fsystem as 16MHz ,I have used 32KHz crystal on XT1 and then using FLL ratio as 512 i have generated Fsystem frequency,I have attached the code i have used (in reference to the sample codes available on the TI site). I have mapped the clock ACLK , MCLK ,SMCLK to port pins 

Observation :

when first checked on the port pins it first shows 

ACLK  = VCC

MCLK = 2.1MHz

 and then when probe been shifted to other pins and back to the MCLK and ACLK pin it shows desired output as

ACLK = 32KHz

MCLK = 16 MHz

Now then i commented the do while loop of Fault flag check in the code, this issue is resolved.

I have no clue on why is the loop effecting the desired response.

Need your help

Regards,

Shweta Shelar

#include <msp430.h>

void main(void)
{
    WDTCTL = WDTPW | WDTHOLD;              // Stop WDT

    // Setup P5.3 output, P1.5 SMCLK, P1.4 MCLK, P1.2 ACLK
    P5DIR |= BIT3;                          // Set P5.3 to output direction
    P5OUT &= ~BIT3;                         // Clear P5.3
    P1DIR |= BIT2 | BIT4 | BIT5;            // ACLK, MCLK, SMCLK set out to pins
    P1SEL0 |= BIT2 | BIT4 | BIT5;            // P1.2,4,5 for debugging purposes.

    // Setup LFXT1
    UCSCTL6 &= ~(XT1OFF);                  // XT1 On
    UCSCTL6 |= XCAP_3;                     // Internal load cap

    // Loop until XT1 fault flag is cleared
    do
    {
        UCSCTL7 &= ~XT1LFOFFG;             // Clear XT1 fault flags
    } while (UCSCTL7 & XT1LFOFFG);         // Test XT1 fault flag

    // Initialize DCO to 2.45MHz
    __bis_SR_register(SCG0);               // Disable the FLL control loop
    UCSCTL0 = 0x0000;                      // Set lowest possible DCOx, MODx
    UCSCTL1 = DCORSEL_5;                   // Set RSELx for DCO = 16 MHz
    UCSCTL2 = FLLD_1 | 511;                 // Set DCO Multiplier for 16 MHz
                                           // (N + 1) * FLLRef = Fdco
                                           // (511 + 1) * 32768 = 16MHz
                                           // Set FLL Div = fDCOCLK/2
    __bic_SR_register(SCG0);               // Enable the FLL control loop

    // Worst-case settling time for the DCO when the DCO range bits have been
    // changed is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS chapter in 5xx
    // UG for optimization.
    // 32 x 32 x 16 MHz / 32,768 Hz = 524288 = MCLK cycles for DCO to settle
    __delay_cycles(524288);

    // Loop until XT1, XT2 & DCO fault flag is cleared
    do
    {
        UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
        // Clear XT2,XT1,DCO fault flags
        SFRIFG1 &= ~OFIFG;                 // Clear fault flags
    } while (SFRIFG1 & OFIFG);             // Test oscillator fault flag

    while (1)
    {
        P5OUT ^= BIT3;                      // Toggle P5.3
        __delay_cycles(60000);            // Delay
    }
}

  • Hi Shweta,

    I would like to make some details cleared by you. Please find my comments:

    when first checked on the port pins it first shows

    [Wei] Can you run the device on debug mode and check which line of the code it is running now? 

    And how long the issue continues?

    ACLK  = VCC

    MCLK = 2.1MHz

    and then when probe been shifted to other pins and back to the MCLK and ACLK pin it shows desired output as

    [Wei] Which Pins you shifted to? 

    ACLK = 32KHz

    MCLK = 16 MHz

    Now then i commented the do while loop of Fault flag check in the code, this issue is resolved.

    [Wei] Which while loop you commented? I saw there are 2 while loop in the code.

  • Hello Wei,

    Thank u for your reply

    I m running it in the debug mode ,n this happens at a breakpoint placed after the ucs settings are done.

    The probe is shifted to any other pin ( it seem as if it gets some sort of trigger )

    Important note is that the code is not running it is halted at the breakpoint after the ucs settings are done.

    The do while loop used for fault flag where the SFRIE is been set.



    Regards,
    Shweta

**Attention** This is a public forum