Hi i'm using the msp430f1612 with IAR kickstart compiler. at moment i am just trying to get the comms working on uart 0. sending data is fine. but receiveing data is not. basicaly i have an interrupt routine for the uart RX. When i type a character on the hyperterminal, the program jumps into the RX interrupt and echoes back the received caharacter, however the program does not exit the interrupt, and instead it keeps looping through the routine, the result is that the single character received is continulsly transmitted back to the interrupt. i do not know what the problem is. this is the interrupt code #pragma vector = UART0RX_VECTOR __interrupt void UART_0_RX_isr(void) { char Temp; Temp = U0RXBUF; while (!(IFG1 & UTXIFG0)); U0TXBUF = Temp; } looking at the registers, i see that URXIFG0 flag is cleared when the interrupt is processed, the flag remains clear, but yet the interrupt is being continuosly called. it is as if the the stack has been modified, to jump back to interrupt vector when the interrupt exits. Any Ideas?
Trapped in UART interrupt
Started by ●November 18, 2005
Reply by ●November 18, 20052005-11-18
Hello , show this: #pragma vector = UART0RX_VECTOR __interrupt void UART_0_RX_isr(void) { char Temp; Temp = U0RXBUF; /* while (!(IFG1 & UTXIFG0)); */ IFG1 &= ~URXIFG0; // Receive interrupt flag reset ME1 &= ~URXE0; // UART-RX disable ME1 |= UTXE0; // TX enable U0TXBUF = Temp; } #pragma vector = UART0TX_VECTOR __interrupt void UART_0_TX_isr(void) { U0TXBUF = Temp; ME1 &= ~UTXE0; // ME1 |= URXE0; // IFG1 &= ~URXIFG0; // } piercebrady <piercebrady@pier...> schrieb: Hi i'm using the msp430f1612 with IAR kickstart compiler. at moment i am just trying to get the comms working on uart 0. sending data is fine. but receiveing data is not. basicaly i have an interrupt routine for the uart RX. When i type a character on the hyperterminal, the program jumps into the RX interrupt and echoes back the received caharacter, however the program does not exit the interrupt, and instead it keeps looping through the routine, the result is that the single character received is continulsly transmitted back to the interrupt. i do not know what the problem is. this is the interrupt code #pragma vector = UART0RX_VECTOR __interrupt void UART_0_RX_isr(void) { char Temp; Temp = U0RXBUF; while (!(IFG1 & UTXIFG0)); U0TXBUF = Temp; } looking at the registers, i see that URXIFG0 flag is cleared when the interrupt is processed, the flag remains clear, but yet the interrupt is being continuosly called. it is as if the the stack has been modified, to jump back to interrupt vector when the interrupt exits. Any Ideas? . --------------------------------- . --------------------------------- --------------------------------- Gesendet von Yahoo! Mail - Jetzt mit 1GB kostenlosem Speicher
Reply by ●November 18, 20052005-11-18
>From: piercebrady <piercebrady@pier...> >Subject: [msp430] Trapped in UART interrupt [snip] >basicaly i have an interrupt routine for the uart RX. >When i type a character on the hyperterminal, the program jumps into >the RX interrupt and echoes back the received caharacter, however >the program does not exit the interrupt, and instead it keeps >looping through the routine, the result is that the single character >received is continulsly transmitted back to the interrupt. i do not >know what the problem is. > >this is the interrupt code > >#pragma vector = UART0RX_VECTOR >__interrupt void UART_0_RX_isr(void) >{ >char Temp; >Temp = U0RXBUF; >while (!(IFG1 & UTXIFG0)); >U0TXBUF = Temp; >} > [snip] >Any Ideas? Pierce, No other people jumping in, so I'll offer an idea... Is your hyperterminal set up for full duplex? I.e., is your terminal echoing what it receives and you have two units talking back and forth? Another possibility is if you have the processor set to respond to receive start-edge detection. In this case, the processor can get started and respond to the UART even when it is in LPM mode. In this case, you need to monitor URXIFGx. if it is 0, you need to wait. when it goes high, the buffer has valid data and can be read - See the section of the User's Manual titled "Receive-Start Edge Detect Operation" (pg 13-19 of slau049e.pdf). Just something to check... Let us know how things work out. Rachel Norristown, PA, USA