<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DEBUG UART interrupt troubles in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/DEBUG-UART-interrupt-troubles/m-p/1216357#M59359</link>
    <description>&lt;P&gt;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!&lt;/P&gt;&lt;P&gt;The line looks like:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) &amp;amp; UART_GetStatusFlags(DEBUG_UART))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jan 2021 00:19:15 GMT</pubDate>
    <dc:creator>stdcerr</dc:creator>
    <dc:date>2021-01-19T00:19:15Z</dc:date>
    <item>
      <title>DEBUG UART interrupt troubles</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/DEBUG-UART-interrupt-troubles/m-p/1215987#M59358</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;BR /&gt;My code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//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) &amp;amp; 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;
}&lt;/LI-CODE&gt;&lt;P&gt;What is wrong or what am I missing? Any help is appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 23:27:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/DEBUG-UART-interrupt-troubles/m-p/1215987#M59358</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2021-01-18T23:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: DEBUG UART interrupt troubles</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/DEBUG-UART-interrupt-troubles/m-p/1216357#M59359</link>
      <description>&lt;P&gt;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!&lt;/P&gt;&lt;P&gt;The line looks like:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) &amp;amp; UART_GetStatusFlags(DEBUG_UART))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 00:19:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/DEBUG-UART-interrupt-troubles/m-p/1216357#M59359</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2021-01-19T00:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: DEBUG UART interrupt troubles</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/DEBUG-UART-interrupt-troubles/m-p/1217118#M59368</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 21:10:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/DEBUG-UART-interrupt-troubles/m-p/1217118#M59368</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2021-01-19T21:10:40Z</dc:date>
    </item>
  </channel>
</rss>

