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.
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
Hello,
I'm sorry for the bad posting.I didn´t find a button to edit my main post, that´s why I answered my own question. 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
-- Is your SPI a master or a slave?
It is a master
-- What happens if you enable the timer interrupt and include the while loop?
It works how it should and the SPI - Module pulses always new bytes out
-- Are you enabling both the TxIFG and RxIFG?
No, only the RxIFG, TxIFG is disabled
**Attention** This is a public forum