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.

CC2530 Timer4 Input Capture Problem

Hi, all~

To parse IR signal,  use Timer 3 as timer and Timer 4 channel 0 as input capture channel. P1_0 is a input pin. 

the problem is that program can enter into timer 3 interrupt but not to timer 4 interrupt. That's why? The folling is the major code:

void main(void)
{
  RegisterInit();
  
  Timer4Init();
  
  Timer3Init();
  
  while(1)
  {
    asm("nop");
  }
}

void RegisterInit(void)
{
  //init clock and tick frequency
  CLKCONCMD &= ~0x7f;  //tick speed: 32M, clock speed: 32M
  
  while(CLKCONSTA & 0x40);  //wait for crystal
  
  //init TIMIF
  TIMIF = 0x00;
  
  //timer4 alternative 1
  PERCFG &= ~0x10;
  
  //init P1_0
  P1SEL |= 0x01;     //P1_0 peripheral I/O
  P1DIR &= ~0x01;    //P1_0 input
  
  //init variable
 timerIntCount = 0;
 captureIntCount = 0;
  
  //open global interrupts
  EA = 1;
}

void Timer3Init(void)
{
  T3CTL = 0x00;      //default
  T3CTL |= 0xA0;     //tick speed / 32 = 1MHz
  T3CTL |= 0x08;     //timer4 overflow interrupt
  T3CTL |= 0x04;     //clear counter
  T3CTL |= 0x01;     //down mode
  
  T3CC0 = 0xFA;     //250us interrupt

  T3IE = 1;
  
  T3CTL |= 0x10;    //Timer4 start
}

void Timer4Init(void)
{
  T4CTL = 0x00;     //default
  
  T4CCTL0 = 0x00;  //capture mode
  T4CCTL0 |= 0x40;  //open capture/compare interrupt
  T4CCTL0 |= 0x02;  //capture on failing edge
}


#pragma vector = T3_VECTOR
__interrupt void T3_ISR(void)
{

   T3OVFIF = 0;

   timerIntCount++;

   T3CTL |= 0x10;

   T3CC0 = 0xFA;

}

#pragma vector = T4_VECTOR
__interrupt void T4_ISR(void)
{

   captureIntCount++;
   //parse IR signal
}

Thanks everybody