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.

MSP430FR6989: Output of toggle signal from TImerA

Part Number: MSP430FR6989

We are trying to output a clock signal from our MSP430, of ~1.5MHz for an external sensor. From our research we think this should work -

int main(void) {

    WDTCTL = WDTPW | WDTHOLD;

    //Pre-config
    P1OUT  = 0;
    P1SEL0 = 0;
    P1SEL1 = 0;

    // Configure GPIO
    P1DIR  |= (BIT0|BIT7);                   //Using both P1.0 (TA0.1) and P1.7(TA0.2) for debug here
    P1OUT  |= (BIT0|BIT7);

    P1SEL0 |= (BIT0|BIT7);
    P1SEL1 |= (BIT0|BIT7);

    // Disable the GPIO power-on default high-impedance mode to activate previously configured port settings
    PM5CTL0 &= ~LOCKLPM5;

    //Timer Setup
    TA0CCTL0 = OUTMOD_7;      // @note   OUTMOD_4 didn't work either
    TA0CCR0  = 20;
    TA0CCR0  = 10;
    TA0CTL   = (TASSEL__SMCLK|MC__UP);

    __bis_SR_register(LPM0_bits + GIE);  // Enter LPM0 w/ interrupt

    return;
}

Why is this not working? How can we get a toggle (OUTMOD_4) event output to a pin?

  • >   TA0CCTL0 = OUTMOD_7;      // @note   OUTMOD_4 didn't work either
    >   TA0CCR0  = 20;
    >   TA0CCR0  = 10;

    TA0.1 corresponds to TA0CCR1, and TA0.2 to TA0CCR2. You should set OUTMOD_7 in TA0CCTL1/2, and the second assignment to TA0CCR0 should be to TA0CCR1/2.

    >    P1SEL0 |= (BIT0|BIT7);
    >    P1SEL1 |= (BIT0|BIT7);
    P1SEL.7=1/1 is correct for P1.7 (TA0.2), but for P1.0 (TA0.1) you need P1SEL.0=0/1, so you should be clearing P1SEL1.0, not setting it. [Ref Data Sheet (SLAS789C) Table 6-20]

     

  • hehe thanks for the quick reply Bruce, be right back!

  • Thank you Bruce, here is my final solution for toggling P1.7 -

    int main(void) {
    
        //System Init
        WDTCTL = (WDTPW|WDTHOLD);               // Stop WDT
    
        //Configure GPIO (TA0.2 at P1.7)
        P1DIR  = (BIT7);
        P1SEL0 = (BIT7);
        P1SEL1 = (BIT7);
    
        //Disable the GPIO power-on default high-impedance mode
        PM5CTL0 &= ~LOCKLPM5;                  // Activate previously configured port settings
    
        //Timer Init
        TA0CCTL2 = OUTMOD_4;                   // Toggle on CCR0 (Fig. 25-2)
        TA0CCR0  = 1;
        TA0CTL   = (TASSEL__SMCLK|MC__UP);     // SMCLK, UP mode
    
        //Launch
        __bis_SR_register(LPM0_bits + GIE);    // Enter LPM0 w/interrupt
        __no_operation();                      // Debug loc
    
        return EXIT_SUCCESS;
    }

**Attention** This is a public forum