msp430 uart and timer interrupts

1.1k views Asked by At

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;
}
1

There are 1 answers

0
Olivia Stork On

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.