Hello,
I have a problem with two interrupts on my MSP430FR5889:
Timer A0 and eUSCI Module A0 are activated and get their clock both from SMCLK/DCO (8 MHz). The Timer should always count to a value in the background and call a subroutine every x seconds. The SPI-Module transmitts always a value (here 0xE7).
The software writes a byte in the TX-Buffer and enables Sleep Mode. If a byte was received, the follwing ISR is called:
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A0_VECTOR __interrupt #elif defined(__GNUC__) __attribute__((interrupt(USCI_A0_VECTOR))) #endif void USCI_A0_ISR(void) { switch(__even_in_range(UCA0IV,4)) { case 2: while(!(EUSCI_A_SPI_getInterruptStatus(EUSCI_A0_BASE, EUSCI_A_SPI_TRANSMIT_INTERRUPT))); __bic_SR_register_on_exit(CPUOFF); RXedDATA = EUSCI_A_SPI_receiveData(EUSCI_A0_BASE); break; default: break; } }
Why is the red line necessary? The following happend:
1. The programm never jumps in the while-loop.
2. If I disable the TimerA0 Interrupt, the software also works without the while-loop.
3. But when the TimerA0 Interrupt is enabled and the while-loop is missing, the SPI-Module clocks out some bytes, but suddenly the programm
remains in sleep mode.
The Timer ISR is:
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer0_A0_ISR (void)
{
do_anything_with_every_call_of_ISR();
TA0CCR0 += 39999;
}
Maybe someone here had the same problem and can explain it. Why is the RX Interrupt dependent on the TimerA0 Interrupt?
Thanks
MCMajus