Hi,
I'm working with a MSP-EXP430G2 Launch pad and modifying demo code of a DLP-9070ABP RFID booster pad. I'm trying to switch the code to call the RFID "FindTag" function from an interrupt rather than from a While Loop. I've setup a TIMERA1 Interrupt to check the RFID approximately every 2 seconds.
Here is the new Interrupt Routine.
#pragma vector=TIMER1_A1_VECTOR
__interrupt void Timer_A(void) {
//Stop the counter
TA1CTL &= ~(MC0 + MC1);
//Process the Interrupt Register
//Only handles CCR1, CCR2, and Overflow
//CCR0 Handled by different Interrupt
switch (TA1IV) {
case TA1IV_NONE:
break;
case TA1IV_TACCR1:
Nfc_FindTag();
// McuDelayMillisecond(1000);
// // Add Offset to TA1CCR1
TA1CCR1 += 3 * 2000;
// break;
case TA1IV_TACCR2:
break;
case TA1IV_6:
break;
case TA1IV_8:
break;
case TA1IV_TAIFG:
break;
default:
break;
}
TA1CTL |= MC_1;
}
Unfortunately, I'm now in a TRAP waiting for TIMER0 to complete.
g_ui8IrqFlag = 0x00;
// Setup for the Timer
McuCounterSet();
// Calculate the timeout value for the timer
COUNTER_VALUE = COUNT_1ms * ui8TxTimeout;
// Start the Timeout
START_COUNTER;
while((g_ui8IrqFlag == 0x00) && (g_ui8TimeoutFlag == 0x00)) // Wait for an interrupt
{
// Do Nothing
}
McuCounter sets up the following TIMER0 settings:
void
McuCounterSet(void)
{
TACTL |= TASSEL_1 + TACLR; // ACLK = 1.5 kHz, timer stopped
TACCTL0 |= CCIE; // compare interrupt enable
}
The TIMERA0 Interrupt is shown below.
//===============================================================
// Timer A0 Interrupt Vector
//===============================================================
#pragma vector=TIMER0_A0_VECTOR
__interrupt void
Msp430g2xx3TimerAHandler(void)
{
uint8_t ui8IrqStatus;
ui8IrqStatus = 0x00;
STOP_COUNTER;
g_ui8TimeoutFlag = 0x01;
Trf797xReadIrqStatus(&ui8IrqStatus);
ui8IrqStatus = ui8IrqStatus & 0xF7; // Set the parity flag to 0
if(ui8IrqStatus == TRF797x_IRQ_STATUS_TX_COMPLETE)
{
g_sTrf797xStatus = TX_COMPLETE;
}
else if(ui8IrqStatus == TRF797x_IRQ_STATUS_IDLE)
{
g_sTrf797xStatus = NO_RESPONSE_RECEIVED;
}
else
{
g_sTrf797xStatus = RX_WAIT;
}
}
I'm stuck in a While loop because TIMER0 Interrupt is not triggering. Is this because I'm already trapped in an iterrupt and can't call a 2nd Interrupt? Any suggestions would be greatly appreciated.
