<?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>Kinetis MicrocontrollersのトピックRe: Identifying UART interrupt source on KL15</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266699#M8705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kan, thanks for your reply.&lt;/P&gt;&lt;P&gt;Actually what you said is almost similar to what is currently going on in my firmware. Every time the "if condition" on line 7 is validated as true, the ISR makes a function call to a block of code that transmits bytes from the TX buffer. If the buffer is empty, it has no effect and the function call returns without doing anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just don't like the way this implementation causes unnecessary function calls&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt; even when the interrupt is not &lt;/SPAN&gt;originated&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt; by the TDRE flag in the first place. The TDRE flag can very likely be true even when the interrupt is originated by RDRF or something else.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For simple code, like in your sample, this extra overhead is nothing much to worry about. But I am running a RTOS and each interrupt gives a semaphore. So for very high speed UART data transfer (460800 Baud rate or above), this extra function call+semaphore operation can take away some much needed performance. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Apr 2013 06:43:34 GMT</pubDate>
    <dc:creator>Safwat</dc:creator>
    <dc:date>2013-04-16T06:43:34Z</dc:date>
    <item>
      <title>Identifying UART interrupt source on KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266697#M8703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I am using a KL15 device for my project. I am using the TDRE and RDRF interrupts for my UART. The RDRF interrupt is always turned on so that I dont miss any incoming byte. The TDRE interrupt is turned on only when I have some data in my UART buffer that needs to be sent. This is what i check inside the UART ISR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13660188505367068" jivemacro_uid="_13660188505367068" modifiedtitle="true"&gt;
&lt;P&gt;void UART1_IRQHandler()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* A variable to capture the Data in the RX buffer&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; uint8_t RcvdByte;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* Check for the source of the interrupt */&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;&amp;nbsp; /* Start with checking the TDRE flag */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if(UART1_S1 &amp;amp; UART_S1_TDRE_MASK)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* Interrupt triggered due to TX buffer being empty */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Call a function to send some data&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;&amp;nbsp; /* Then check the RDRF flag */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if (UART1_S1 &amp;amp; UART_S1_RDRF_MASK)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* Interrupt triggered due to Rx Buffer full */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; RcvdByte = UART1_D; // Interrupt is cleared here, so no re-entrance will occur&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Call the function to collect the data&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When my device boots up, the RDRF interrupt is on and the TDRE interrupt is off (because there is no data to send). So now, when i receive a byte the ISR runs and finds that the TDRE flag is set (default value after reset) although it wasnt the source of the interrupt. So the function assigned the TDRE flag gets called unnecessarily. How am I able to pin point the source of the interrupt in such cases?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Apr 2013 09:55:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266697#M8703</guid>
      <dc:creator>Safwat</dc:creator>
      <dc:date>2013-04-15T09:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying UART interrupt source on KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266698#M8704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Safwat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think when you enable &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;TDRE&lt;/SPAN&gt; interrupt, there should be a TX buffer ready, right? if so, then you may implement the ISR like that:&lt;/P&gt;&lt;P&gt;uin8 tx_buffer[128];&lt;/P&gt;&lt;P&gt;uint8* ptr = tx_buffer;&lt;/P&gt;&lt;P&gt;uint32 tx_length = 0;&lt;/P&gt;&lt;OL class="dp-cpp" start="1" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; list-style-position: initial; list-style-image: initial; background-color: #ffffff; color: #5c5c5c; margin: 0 0 1px 45px !important;"&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&lt;SPAN class="keyword" style="font-style: inherit; color: #006699; background-color: inherit; font-size: 9pt !important;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt; UART1_IRQHandler()&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;{&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;/* A variable to capture the Data in the RX buffer*/&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; uint8_t RcvdByte;&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;/* Check for the source of the interrupt */&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;/* Start with checking the TDRE flag */&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="keyword" style="font-style: inherit; color: #006699; background-color: inherit; font-size: 9pt !important;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;(UART1_S1 &amp;amp; UART_S1_TDRE_MASK)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; {&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;/* Interrupt triggered due to TX buffer being empty */&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;// Call a function to send some data&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-family: helvetica, arial;"&gt;if ptr&amp;lt;tx_buffer+tx_length&lt;/SPAN&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;UART1_D = *ptr;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;ptr++;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;else&lt;/SPAN&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;ptr = &amp;amp;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #ffffff;"&gt;tx_buffer&lt;/SPAN&gt;[0];&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; }&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;/* Then check the RDRF flag */&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="keyword" style="font-style: inherit; color: #006699; background-color: inherit; font-size: 9pt !important;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt; (UART1_S1 &amp;amp; UART_S1_RDRF_MASK)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; {&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;/* Interrupt triggered due to Rx Buffer full */&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; RcvdByte = UART1_D; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;// Interrupt is cleared here, so no re-entrance will occur&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment" style="font-style: inherit; color: #008200; background-color: inherit; font-size: 9pt !important;"&gt;// Call the function to collect the data&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; }&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;}&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;Hope that helps,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-family: helvetica, arial; color: black; background-color: inherit; font-size: 9pt !important;"&gt;Kan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 06:20:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266698#M8704</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2013-04-16T06:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying UART interrupt source on KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266699#M8705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kan, thanks for your reply.&lt;/P&gt;&lt;P&gt;Actually what you said is almost similar to what is currently going on in my firmware. Every time the "if condition" on line 7 is validated as true, the ISR makes a function call to a block of code that transmits bytes from the TX buffer. If the buffer is empty, it has no effect and the function call returns without doing anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just don't like the way this implementation causes unnecessary function calls&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt; even when the interrupt is not &lt;/SPAN&gt;originated&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt; by the TDRE flag in the first place. The TDRE flag can very likely be true even when the interrupt is originated by RDRF or something else.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For simple code, like in your sample, this extra overhead is nothing much to worry about. But I am running a RTOS and each interrupt gives a semaphore. So for very high speed UART data transfer (460800 Baud rate or above), this extra function call+semaphore operation can take away some much needed performance. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 06:43:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266699#M8705</guid>
      <dc:creator>Safwat</dc:creator>
      <dc:date>2013-04-16T06:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying UART interrupt source on KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266700#M8706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Safwat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand your concerns , so I think for your case, send character in UART ISR is not a good solution, you may use DMA to do that. In other words, ISR acts as RX ISR, and when code start to send , enable the TX DMA. Please also note enable CS(Cycle steal) in that case, which Forces a single read/write transfer per DMA request.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Kan Li&lt;/P&gt;&lt;P&gt;Technical Information &amp;amp; Commercial Support AP (Kinetis/ColdFire)&lt;/P&gt;&lt;P&gt;Freescale Semiconductor (China) Limited Shanghai Branch Office&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 07:49:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266700#M8706</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2013-04-16T07:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying UART interrupt source on KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266701#M8707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I think I have to change my code to use Tx DMA. Initially I started off with slower baud rate so things where not so bad. But unfortunately the requirements of my application increased. Hopefully I can get DMA working without much issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for providing the direction Kan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 08:34:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266701#M8707</guid>
      <dc:creator>Safwat</dc:creator>
      <dc:date>2013-04-16T08:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying UART interrupt source on KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266702#M8708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use DMA for transferring data from UART1 to UART0 on the KL15. I am using DMA channel 1. My code for initializing the DMA is below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_13710338652025385 jive_macro_code" jivemacro_uid="_13710338652025385"&gt;
&lt;P&gt;void DMA_Init()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* Enable the clock to DMA MUX and DMA */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; SIM_SCGC6 |= SIM_SCGC6_DMAMUX_MASK;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; SIM_SCGC7 |= SIM_SCGC7_DMA_MASK;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Disable the DMA0 channel&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMAMUX0_CHCFG1 = 0x00;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Clear pending errors or the done bit for channel 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if (((DMA_DSR_BCR1 &amp;amp; DMA_DSR_BCR_DONE_MASK) == DMA_DSR_BCR_DONE_MASK)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | ((DMA_DSR_BCR1 &amp;amp; DMA_DSR_BCR_BES_MASK) == DMA_DSR_BCR_BES_MASK)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | ((DMA_DSR_BCR1 &amp;amp; DMA_DSR_BCR_BED_MASK) == DMA_DSR_BCR_BED_MASK)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | ((DMA_DSR_BCR1 &amp;amp; DMA_DSR_BCR_CE_MASK) == DMA_DSR_BCR_CE_MASK))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DMA_DSR_BCR1 |= DMA_DSR_BCR_DONE_MASK;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Set Source Address for DMA (UART1_D register)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMA_SAR1 = 0x4006B007;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Clear the DCR bits&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMA_DCR1 &amp;amp;= ~(DMA_DCR_SSIZE_MASK | DMA_DCR_CS_MASK);//0x0202;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Set the DMA configuration&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMA_DCR1 |= (DMA_DCR_SSIZE(1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | DMA_DCR_DSIZE(1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | DMA_DCR_CS_MASK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | DMA_DCR_ERQ_MASK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | DMA_DCR_EADREQ_MASK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Set DMA byte counter&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMA_DSR_BCR1 = DMA_DSR_BCR_BCR(3);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Set Destination Address (UART0_D)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMA_DAR1 = 0x4006A007;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Enable UART1 operation in the DMA source slot&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMAMUX0_CHCFG1 = 0x4;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // Enable the DMA MUX&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DMAMUX0_CHCFG1 |= DMAMUX_CHCFG_ENBL_MASK;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This setup is passing only the first 3 bytes of data received at UART1. Which makes sense as I set the BCR to 3. My question is, is there any way to configure the DMA so that it is not dependent upon the counter. I want the DMA to transfer incoming byte at UART1 to UART0 as long as DMA request bit in UART1 is enabled. Can it be configured to work that way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 10:43:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266702#M8708</guid>
      <dc:creator>Safwat</dc:creator>
      <dc:date>2013-06-12T10:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying UART interrupt source on KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266703#M8709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay I figured out I can use the DMA transfer complete interrupt to reload the BCR. One interrupt for every 0xFFFFF bytes is obviously acceptable. Sorry for asking without thinking much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 16:55:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Identifying-UART-interrupt-source-on-KL15/m-p/266703#M8709</guid>
      <dc:creator>Safwat</dc:creator>
      <dc:date>2013-06-12T16:55:23Z</dc:date>
    </item>
  </channel>
</rss>

