<?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 Question on proper servicing procedures of eDMA-enabled Uarts.  in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Question-on-proper-servicing-procedures-of-eDMA-enabled-Uarts/m-p/663354#M7267</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been handed a project that has a uart that is tied to a 485 port. &amp;nbsp;The code I received is clearly based on the uart_edma_non_blocking example but it's not working as needed and I'm not finding much documentation on how that example was supposed to work. &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifics:&lt;BR /&gt;Processor: &amp;nbsp;MKV31F&lt;/P&gt;&lt;P&gt;IDE:&amp;nbsp;&amp;nbsp;&amp;nbsp;Kinetis Design Studio &amp;nbsp;&amp;nbsp;&lt;BR /&gt;SDK: &amp;nbsp;KSDK_1.3.0 &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;This unit is going to be on a fairly busy communication network. &amp;nbsp;As such I hope to be able to check in on the incoming buffer every milisecond or so, gather all of the data it has and then parse it for action items, etc. &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;The code I was handed is clearly based on this example code: &amp;nbsp;&amp;nbsp;&lt;BR /&gt;C:\Freescale\KSDK_1.3.0\examples\frdmkv31f\driver_examples\uart\uart_edma_non_blocking&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In it there is a while loop that checks for a single byte coming off of the wire, then it sends that byte back on the wire. &amp;nbsp;It's meant to be a non-blocking example but as it's written it's basically still blocking. &amp;nbsp;What's more, once I put this device on a loaded network it chokes and turns off the interrupts entirely making me think I'm not servising it properly. &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code straight from the DMA non-blocking uart example: &amp;nbsp;&lt;/P&gt;&lt;P&gt;while(true)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;// Call received API&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;UART_DRV_EdmaReceiveData(BOARD_DEBUG_UART_INSTANCE, &amp;amp;rxChar, 1u);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Wait until we receive a character&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;while (kStatus_UART_RxBusy == UART_DRV_EdmaGetReceiveStatus(BOARD_DEBUG_UART_INSTANCE, NULL)) &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Echo received character&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;txChar = rxChar;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;UART_DRV_EdmaSendData(BOARD_DEBUG_UART_INSTANCE, &amp;amp;txChar, 1u);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;How should I be using the "&lt;SPAN&gt;UART_DRV_EdmaReceiveData" function? &amp;nbsp;Do I hit it once, then remain locked in a loop until the &lt;SPAN&gt;UART_DRV_EdmaGetReceiveStatus says it's not busy? &amp;nbsp;Should I hit the&amp;nbsp;UART_DRV_EdmaReceiveData, then bounce out and do other chores for a milisecond, then come back and see if it's completed? &amp;nbsp;What makes it say it's completed? &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Also, assuming "rxChar" is redefined as an array, what are the implications of asking for more than one byte at a time? &amp;nbsp;Does the rxbusy flag indicate that I've received the number I expected or simply that we're between bytes on the wire? &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had though that there might be documentation for these functions but I'm really not seeing them. &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts or links to manuals would be appreciated. &amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Leeds&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For what it's worth, sending data works just fine for me. &amp;nbsp;It's just servicing the receiving portion that isn't yet clear to me. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Oct 2016 19:19:29 GMT</pubDate>
    <dc:creator>leedsallen</dc:creator>
    <dc:date>2016-10-24T19:19:29Z</dc:date>
    <item>
      <title>Question on proper servicing procedures of eDMA-enabled Uarts. </title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Question-on-proper-servicing-procedures-of-eDMA-enabled-Uarts/m-p/663354#M7267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been handed a project that has a uart that is tied to a 485 port. &amp;nbsp;The code I received is clearly based on the uart_edma_non_blocking example but it's not working as needed and I'm not finding much documentation on how that example was supposed to work. &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifics:&lt;BR /&gt;Processor: &amp;nbsp;MKV31F&lt;/P&gt;&lt;P&gt;IDE:&amp;nbsp;&amp;nbsp;&amp;nbsp;Kinetis Design Studio &amp;nbsp;&amp;nbsp;&lt;BR /&gt;SDK: &amp;nbsp;KSDK_1.3.0 &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;This unit is going to be on a fairly busy communication network. &amp;nbsp;As such I hope to be able to check in on the incoming buffer every milisecond or so, gather all of the data it has and then parse it for action items, etc. &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;The code I was handed is clearly based on this example code: &amp;nbsp;&amp;nbsp;&lt;BR /&gt;C:\Freescale\KSDK_1.3.0\examples\frdmkv31f\driver_examples\uart\uart_edma_non_blocking&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In it there is a while loop that checks for a single byte coming off of the wire, then it sends that byte back on the wire. &amp;nbsp;It's meant to be a non-blocking example but as it's written it's basically still blocking. &amp;nbsp;What's more, once I put this device on a loaded network it chokes and turns off the interrupts entirely making me think I'm not servising it properly. &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code straight from the DMA non-blocking uart example: &amp;nbsp;&lt;/P&gt;&lt;P&gt;while(true)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;// Call received API&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;UART_DRV_EdmaReceiveData(BOARD_DEBUG_UART_INSTANCE, &amp;amp;rxChar, 1u);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Wait until we receive a character&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;while (kStatus_UART_RxBusy == UART_DRV_EdmaGetReceiveStatus(BOARD_DEBUG_UART_INSTANCE, NULL)) &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Echo received character&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;txChar = rxChar;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;UART_DRV_EdmaSendData(BOARD_DEBUG_UART_INSTANCE, &amp;amp;txChar, 1u);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;How should I be using the "&lt;SPAN&gt;UART_DRV_EdmaReceiveData" function? &amp;nbsp;Do I hit it once, then remain locked in a loop until the &lt;SPAN&gt;UART_DRV_EdmaGetReceiveStatus says it's not busy? &amp;nbsp;Should I hit the&amp;nbsp;UART_DRV_EdmaReceiveData, then bounce out and do other chores for a milisecond, then come back and see if it's completed? &amp;nbsp;What makes it say it's completed? &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Also, assuming "rxChar" is redefined as an array, what are the implications of asking for more than one byte at a time? &amp;nbsp;Does the rxbusy flag indicate that I've received the number I expected or simply that we're between bytes on the wire? &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had though that there might be documentation for these functions but I'm really not seeing them. &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts or links to manuals would be appreciated. &amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Leeds&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For what it's worth, sending data works just fine for me. &amp;nbsp;It's just servicing the receiving portion that isn't yet clear to me. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Oct 2016 19:19:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Question-on-proper-servicing-procedures-of-eDMA-enabled-Uarts/m-p/663354#M7267</guid>
      <dc:creator>leedsallen</dc:creator>
      <dc:date>2016-10-24T19:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Question on proper servicing procedures of eDMA-enabled Uarts.</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Question-on-proper-servicing-procedures-of-eDMA-enabled-Uarts/m-p/663355#M7268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Leeds,&lt;/P&gt;&lt;P&gt;- The KSDK is open source ,you can find the function source code , for example the function&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;UART_DRV_EdmaReceiveData&lt;/SPAN&gt;" and "UART_DRV_EdmaReceiveDataBlocking "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/8288i4C08494A1026FF21/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/8328i949EF4D632562929/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If you use the function "&lt;SPAN&gt;UART_DRV_EdmaReceiveData&lt;/SPAN&gt;" , yes , you need&amp;nbsp; read the statue to&lt;/P&gt;&lt;P&gt;check whether the receive has completed , for example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;// Wait until we receive a character&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (kStatus_UART_RxBusy == UART_DRV_EdmaGetReceiveStatus(BOARD_DEBUG_UART_INSTANCE, NULL)){}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use the block receive function , the function does not return until the receive is complete .&lt;/P&gt;&lt;P&gt;So you need refer to your requirement to use .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2016 07:49:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Question-on-proper-servicing-procedures-of-eDMA-enabled-Uarts/m-p/663355#M7268</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2016-10-26T07:49:25Z</dc:date>
    </item>
  </channel>
</rss>

