DEBUG UART interrupt troubles

cancel
Showing results for 
Search instead for 
Did you mean: 

DEBUG UART interrupt troubles

Jump to solution
493 Views
stdcerr
Contributor IV

Hi,

 

We are using the DEBUG UART to send out data on a consecutive basis which worked just fine. Now we added a feature where we also want to receive some command characters so I added Interrupt control to the UART but it turns out, that when the program starts,m it first expects to receive a character before it starts sending out any data (which is not whast we want) also, it seems that it stop sending after every character I send from the terminal and only resumes when it receives an even number of chars.... why is this and how can I fix it?
My code looks like this:

 

//Macros
#define DEBUG_UART			  UART0
#define DEBUG_UART_IRQn       UART0_RX_TX_IRQn
#define DEBUG_UART_IRQHandler UART0_RX_TX_IRQHandler

//enabling the interrupt
UART_EnableInterrupts(DEBUG_UART, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable);
EnableIRQ(DEBUG_UART_IRQn);

//ISR
void DEBUG_UART_IRQHandler(void) {
	uint8_t rxChar = 0U;

	/* If new data arrived. */
	if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(DEBUG_UART))
	{
		rxChar = UART_ReadByte(DEBUG_PERIPHERAL);
		if(rxChar == '*') {
			toggleDebugging();
		} else if (isDebugging()) {
			setMode(rxChar);
		} else {
			if(rxChar == '@'){
				receivingCommandFlag = true;
				rxIndex = 0;
				inCommingFlag = false;
			}else if(receivingCommandFlag){
				rxBuffer[rxIndex] = rxChar;
				rxIndex++;
				if(rxChar==0xa || rxChar==0xd){
					inCommingFlag = true;
				}
			}
		}
	}
	SDK_ISR_EXIT_BARRIER;
}

What is wrong or what am I missing? Any help is appreciated!

0 Kudos
1 Solution
476 Views
stdcerr
Contributor IV

I think I found that the UART IRQ code works fine as posted but that the problem is caused by a different area in the code.

View solution in original post

0 Kudos
2 Replies
488 Views
stdcerr
Contributor IV

It seems like it might have to do something with UART_GetStatusFlags() as this is where it hangs when I suspend the session (while it doesn't send characters due to having received a single char). What's up with that, I'm confused!

The line looks like:

if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(DEBUG_UART))

 

0 Kudos
477 Views
stdcerr
Contributor IV

I think I found that the UART IRQ code works fine as posted but that the problem is caused by a different area in the code.

0 Kudos