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.

CC430 timer capture interrupts trapped

Hi,

I'm using cc430 timer capture mode to do some signal frequency measurement experiments.

I set up TA0 and CCR as following register values:

    TA0CTL|=TACLR+TASSEL__TACLK+ID_0+MC__CONTINUOUS; 
    TA0CCTL2|=CCIS_1+CAP+SCS+CM_1+CCIE;     
    TA0CCTL3|=CCIS_1+CAP+SCS+CM_1+CCIE;     

The Timer input is an external 10MHz clock source, CCR2|CCI2B input is ACLK/2 which is about 16kHz, CCR3|CCI3B input is GDO1 clk, which is about 135kHz.

The interrupt trigger a TA0CCRx register value reading on every 320 captures, which prolonged the measurement period. The interrupt service code is following:

static int Captures=0;
static int Captures1=0;
#define NCAPTURES 320
#define NCAPTURES1 320
#define FACLK 1.027//0.2925
#pragma vector=TIMER0_A1_VECTOR
__interrupt void TimerA(void)
{
//	 TA0CTL|=TACLR;//TASSEL__INCLK+ID_0+MC__CONTINUOUS;
   switch(__even_in_range(TA0IV,8))
   {
      case 4:
             switch(Captures){
             case 0:
                   starttime=TA0CCR2;
                   Captures=NCAPTURES;
                   break;
             case 1:
                   num1=TA0CCR2;
                   TA0CTL|=TACLR;
                   Captures=0;
                   sprintf(buffer1,"1 %lu\n",num1);
		putstr(buffer1); 
                   break;
             default:
                    Captures--;
                    break;

             }
      case 6:
             switch(Captures1){
             case 0:
                   starttime1=TA0CCR3;
                   Captures1=NCAPTURES1;
                   break;
             case 1:
                   num2=TA0CCR3;
                   TA0CTL|=TACLR;
                   Captures1=0;
		sprintf(buffer2,"2 %lu\n",num2);
		putstr(buffer2);                   
                break;
             default:
                    Captures1--;
                    break;

             }
      default:break;
   }
   __bic_SR_register_on_exit(LPM3_bits);


}

When I have only CCR2 enabled and CCR3 disabled, everything works fine. Once I enable CCR3 both capture interrupts works fine but the program trapped in the Timer interrupt and cannot jump back to the main loop. I am wondering why this happened, possible reason might be the frequency of CCR3 input is faster than the system main clock?

Thanks in advance!

**Attention** This is a public forum