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.

TimerA interrupt blocking RF1A transmission

Hi, I'm having a problem with RF1A RX end-of-packet not being recognized because a Timer interrupt is blocking it. In my project, when one node wants to send data, it sends out a RTS and waits for a CTS. If CTS is not received within 20ms, the node aborts transmission and goes back to RX mode.

So for my timer, I set the CCR value to a value that will get me 20ms, and in the Timer ISR, if it's met (ie. timer not stopped), it will abort transmission:

Setting up Timer

void ll_timerStart(void) {
	/* Setup timer to wait T_WAIT = 200ms */
	timerStarted = 1;
	TA0CCTL0 = CCIE;                          			// CCR0 interrupt enabled
	TA0CCR0 = 655;									 
	TA0CTL = TASSEL__ACLK + MC__UP + TACLR ;   	// ACLK, upmode, clear TAR
}

Timer ISR

if(ll_smFlags & LL_SENDING) {
	/* The only time this timer is used when node is sending is to 
	 * check if CTS is received within T_WAIT. Timer is 
	 * automatically stopped when CTS packet is received.
	 */
	printf("CTS not received within T_WAIT\r\n");
	/* abort sending data */
	ll_smFlags &= ~LL_SENDING;
	/* stop timer */
	ll_timerStop();
} 

RF1A interrupt

#pragma vector=CC1101_VECTOR
__interrupt void CC1101_ISR(void)
{
	switch(__even_in_range(RF1AIV,32))        // Prioritizing Radio Core Interrupts 
	{
	case  0:                                // No RF core interrupt pending                                            
		RF1A_interrupt_handler();             // means RF1A interface interrupt pending
		break; 
	case  2: break;                         // RFIFG0 
	case  4: break;                         // RFIFG1
	case  6: break;                         // RFIFG2
	case  8: break;                         // RFIFG3
	case 10:                                // RFIFG4 - RX end-of-packet
		packetReceived = 1;
		break;
	case 12: break;                         // RFIFG5
	case 14: break;                         // RFIFG6          
	case 16: break;                         // RFIFG7
	case 18: break;                         // RFIFG8
	case 20:                                // RFIFG9 - TX end-of-packet
		printf("TX end-of-packet interrupt\r\n");
		packetTransmit = 1;                   
		break;
	case 22: break;                         // RFIFG10
	case 24: break;                         // RFIFG11
	case 26: break;                         // RFIFG12
	case 28: break;                         // RFIFG13
	case 30: break;                         // RFIFG14
	case 32: break;                         // RFIFG15
	}  
	__bic_SR_register_on_exit(LPM3_bits);     
}

In the main loop, packetReceived flag is checked. If the packet coming in is a data packet, the timer is stopped automatically.

The problem is that I can't get packetReceived to be 1 when the timer is running. On the other node, the CTS packet will not be transmitted until this node has stopped its timer so it waits for timer to be stopped before sending, which is very weird.

I tried increasing the timer CCR value to suits 500ms but the same thing happens again. It seems like the Timer interrupt is blocking the node from receiving data and therefore, timer couldn't be stopped.