2

I have msp430 family mcu (actually msp430g2553 on launchpad board). I have written uart driver and it works. But after I have added timer driver I found some problems: uart stops working after first timer interrupt. Do I need to restore some flags in timer interrupt handler?

interrupt(TIMER0_A0_VECTOR) enablenested timer0_isr() {
    P1OUT ^= BIT6;
}

void timer_init(void) {
    int i;
    TACTL = TASSEL_2 + ID_3 + MC_1 + TAIE;
    TA0CCR0 = 0xffff;
    TACCTL0 = CM_0 + CCIE;
}
Vladimir Berlev
  • 502
  • 4
  • 16
  • 1
    To see whether the micro is stuck in the ISR, maybe try adding a LED blinker to the main program (or even in the UART ISR). Ridiculously simple idea, I know, but sometimes these can be which spot a problem. – Jubatian Dec 01 '14 at 18:29

1 Answers1

1

Since you're just counting from 0 to 0xFFFF, you don't really need to be in "up mode" (MC_1) where you count to the value in register TA0CCR0, you could be in "continuous mode" (MC_2) which automatically counts from 0 to 0xFFFF and would remove the need for any TA0CCRX registers, if I recall correctly.

Otherwise you should get into the habit of saying TACTL = TACLR; (which clears this register) before you set any values in it, perhaps that could help.

Olivia Stork
  • 4,660
  • 5
  • 27
  • 40