DEBUG UART interrupt troubles

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

DEBUG UART interrupt troubles

跳至解决方案
1,444 次查看
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 项奖励
回复
1 解答
1,427 次查看
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 项奖励
回复
2 回复数
1,439 次查看
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 项奖励
回复
1,428 次查看
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 项奖励
回复