Hello,
I’m working on ir learning with cc2533. But I don’t succed in capturing anything …
My IR_IN is on Port 1 pin 0.
Here is my initialization code :
“
void initIR_Reception(void)
{
// Peripheral I/O control
PERCFG |= 0x40;//P1.1 Timer1 alternative 2
//1st priority: Timer 1 channels 0-1
P2DIR != 0x80;
P2DIR &= ~0x40;
// Port 1 function select
P1SEL |= BV(0);//peripheral
// Port 1 direction register
P1DIR &= ~(0x01);
// Set up timer 1 channel 1 to capture mode 4
T1CCTL1 |= BV(6);//enable interrupt at timer 1 channel 1
T1CCTL1 &= ~BV(2);//Capture mode
T1CCTL1 |= BV(1)|BV(0);//Capture on all edges
P1IEN |= BV(0); // enable interrupt at P1_1
T1IE =1;
// Clear timer
// this will activate the output pin so start timer immediately.
T1CNTL = 0;
// Prevent sleep
osal_pwrmgr_task_state(Hal_TaskID, 1);
//(void)osal_set_event(Hal_TaskID, HAL_PWRMGR_HOLD_EVENT);
//(void)osal_set_event(Hal_TaskID, HAL_PWRMGR_CONSERVE_EVENT);
}
”
I call this function just before getting into osal_start_system().
When an interrupt appears the halProcessIrInterrupt() is supposed to be called.
“
HAL_ISR_FUNCTION( halKeyPort1Isr, P1INT_VECTOR )
{
HAL_ENTER_ISR();
disableKeypadInt();
if ((P1IFG & HAL_KEY_P1_INTERRUPT_PINS ) != 0x00)
{
halProcessKeyInterrupt();
#if HAL_KEY
//Clear Interrupt flag
P1IFG=(uint8) (~HAL_KEY_P1_INTERRUPT_PINS); //clear interrupt flag
P1IF=0x00;
#endif
}
else if ((P1IFG & HAL_IR_P1_INTERRUPT_PINS ) != 0x00)
{
halProcessIrInterrupt();
#if HAL_IR
P1IFG = (uint8) (~HAL_IR_P1_INTERRUPT_PINS);
P1IF = 0;
#endif
//T1STAT = ~0x02;//clear timer 1 channel 1
}
//Clear Interrupt flag
P1IFG=0x00;
P1IF=0x00;
HAL_EXIT_ISR();
}
“
But It doesn’t work at all.
Anybody could help me please ?
Thanks you in advance !