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.

MSP430G2553: ACK problem

Part Number: MSP430G2553


Hello all,

I'm quite new to the MSP430.

 I created an small program:

int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer


P2OUT =0x00;

P2DIR |= 0x02;

CCTL0=CCIE;
TACCR0 = 62500;
TACTL=TASSEL_2| ID_3 |MC_1 |TAIE;


_enable_interrupt();

while (1){

}
return 0;
}

#pragma vector=TIMER0_A0_VECTOR

__interrupt void Timer_A (void){
P2OUT ^=0x02;
TACTL &= ~TAIFG;

}

The program works fine if I use the SMCLK but when I want to use the ACLK(Tassel_1) it does not work. I found out that maybe I need to change to ACK= VCO, so I put the follwoing:

BCSCTL3 |= LFXT1S_2;

Once I put that, It started working for few seconds but after that it jumped to an infinite state with "ISR TRAP". I kind of solved the problem with:

IFG1 &= ~OFIFG; 

But it was still going to the infinite state after some more seconds. The rare thing is, if I put a breakpoint inside the interrupt, it works fine all the time I click to run.  Is it a problem with the timmings?

Thanks and best regards,

Victor

  • >TACTL=TASSEL_2| ID_3 |MC_1 |TAIE;

    Remove TAIE here.  In order to use it, you'd need to supply an additional ISR (TIMER0_A1_VECTOR). [Ref F2 User Guide (SLAU144J) Sec 12.2.6]

    You don't need it, since you have the CCTL0:CCIFG already, which happens at (almost) the same time. Since they happen at almost the same time. you succeeded (by accident) with the faster clock. When you slowed down the clock, The separation became longer, so you were clearing TAIFG too early.

    So Try:

    >TACTL=TASSEL_2| ID_3 |MC_1 ;

  • Hello Bruce,

    Thanks for the help. It works. But I have another small problem. If I check the User guide, 

    BCSCTL3 |= LFXT1S_2 is equal to VCO(12KHz? if im not worng) and 

    BCSCTL3 |= LFXT1S_0 is equal to 32KHz clock. 

    With the 32K clock and putting:

    TACTL=TASSEL_1| ID_0 |MC_1 

    TACCR0 =32000; (1Hz frequency if my claculations are not wrong)

    the LED is blinking more than 6 times in 1 second when it should blink every 1 second.

    Thanks

  • You haven't described your platform. If you're using a Launchpad (G2 or G2ET), and you haven't done any soldering, you don't have a 32kHz clock. The VLOCLK (12kHz +/- 60%) on the other hand is built-in.

    TASSEL=2 requests SMCLK, which (based on your earlier code) is running from the DCO at a speed vaguely resembling 1MHz. So with ID=3 (/8) I expect 1MHz/8/32000= ~4 ISR calls/sec. Each ISR call is half an LED cycle, so I expect blinking at ~2Hz. Does that sound about right? You can get up to ~1Hz by increasing CCR0.

**Attention** This is a public forum