<?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: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262174#M26485</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Yixing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Aug 2014 03:14:06 GMT</pubDate>
    <dc:creator>YixingKong</dc:creator>
    <dc:date>2014-08-01T03:14:06Z</dc:date>
    <item>
      <title>i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262153#M26464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We are using the i.MX28 with the current BSP and have noticed that the UART serial interface is losing data. On closer inspection of the driver I think I have found a bug in the code and could do with some support to resolve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The serial receive interrupt handler function is defined as &lt;STRONG&gt;ULONG SL_RxIntrHandler(PVOID pContext,PUCHAR pTargetBuffer,ULONG *pByteNumber)&lt;/STRONG&gt; at the following path:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\WINCE600\PLATFORM\COMMON\src\soc\COMMON_FSL_V2_PDK1_9\SERIALAPP\COM_PDD\serialhw.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parameters are defined as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pContext&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [in] Pointer to device head.&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pTargetBuffer&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [in] Pointer to the target buffer in which to put the data.&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pByteNumber&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [in] Pointer to, on entry, the maximum number of bytes to read. On exit, the number of&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;&amp;nbsp;&amp;nbsp; bytes read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This follows the Microsoft function prototype for HWRxIntrHandler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found that the pByteNumber value is not the number of bytes to read but a decrementing value each time a block of data is received. On the first receive the value is 2047, and then for each block of received data this value decrements by the size of the last received block each time the RX interrupt handler runs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eventually the pByteNumber passed gets lower than the size of the next block of data received. In this case the remaining data is thrown away and the value reset to 2047. I have some debug output to show this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below I am sending chunks of 409 bytes into the serial port. The 'len' value in the SL_RxIntrHandler+ debug output is actually the *pByteNumber value - clearly not the number of bytes received and also decrementing on each receive.&lt;/P&gt;&lt;P&gt;The ByteRead value is what the RX interrupt got out of the receive - not always 409 bytes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4491457 PID:400002 TID:1a50006 Rx Event&lt;/P&gt;&lt;P&gt;4491457 PID:400002 TID:1a50006 SL_RxIntrHandler+ &lt;STRONG&gt;: len 2047&lt;/STRONG&gt;. EvtChar 0x1a&lt;/P&gt;&lt;P&gt;4491457 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=0,W=0,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4491907 PID:400002 TID:1a50006 Rx Event&lt;/P&gt;&lt;P&gt;4491907 PID:400002 TID:1a50006 SL_RxIntrHandler+ :&lt;STRONG&gt; len 1639&lt;/STRONG&gt;. EvtChar 0x1a&lt;/P&gt;&lt;P&gt;4491907 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=409,W=409,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4494129 PID:400002 TID:1a50006 Rx Event&lt;/P&gt;&lt;P&gt;4494129 PID:400002 TID:1a50006 SL_RxIntrHandler+ : &lt;STRONG&gt;len 1230&lt;/STRONG&gt;. EvtChar 0x1a&lt;/P&gt;&lt;P&gt;4494129 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=818,W=818,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4494753 PID:400002 TID:1a50006 Rx Event&lt;/P&gt;&lt;P&gt;4494753 PID:400002 TID:1a50006 SL_RxIntrHandler+ :&lt;STRONG&gt; len 821&lt;/STRONG&gt;. EvtChar 0x1a&lt;/P&gt;&lt;P&gt;4494753 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=1227,W=1227,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4497799 PID:400002 TID:1a50006 Rx Event&lt;/P&gt;&lt;P&gt;4497799 PID:400002 TID:1a50006 SL_RxIntrHandler+ : &lt;STRONG&gt;len 412&lt;/STRONG&gt;. EvtChar 0x1a&lt;/P&gt;&lt;P&gt;4497799 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=1636,W=1636,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4498068 PID:400002 TID:1a50006 Rx Event&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;&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;**********&amp;nbsp; 409 chars are sent in here but after the function it only reads 3 and throws the rest away *************&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4498068 PID:400002 TID:1a50006 SL_RxIntrHandler+ : &lt;STRONG&gt;len 3&lt;/STRONG&gt;. EvtChar 0x1a&lt;/P&gt;&lt;P&gt;4498068 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=2045,W=2045,BA=0,L=2048) &lt;STRONG&gt;ByteRead=3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4500466 PID:400002 TID:1a50006 Rx Event&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;&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;&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;4500466 PID:400002 TID:1a50006 SL_RxIntrHandler+ : len 2047. EvtChar 0x1a&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;**********&amp;nbsp; len 'counter' value back to 2047 *************&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;4500466 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=0,W=0,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4500906 PID:400002 TID:1a50006 Rx Event&lt;/P&gt;&lt;P&gt;4500906 PID:400002 TID:1a50006 SL_RxIntrHandler+ : len 1639. EvtChar 0x1a&lt;/P&gt;&lt;P&gt;4500906 PID:400002 TID:1a50006 After HWGetBytes, Fifo(R=409,W=409,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The calling function SerialEventHandler() is in the freescale file mdd.c at the following path and calls the above using a function pointer as pFuncTbl-&amp;gt;HWRxIntrHandler:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\WINCE600\PLATFORM\COMMON\src\soc\COMMON_FSL_V2_PDK1_9\SERIALAPP\COM_MDD2\mdd.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As part of this function it calculates a 'RoomLeft' variable and passes a pointer to this in to the HWRxIntrHandler as the 'pByteNumber' parameter. Clearly this is not the correct thing to be passing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ( RxRIndex == 0 ) {&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;&amp;nbsp;&amp;nbsp; // have to leave one byte free.&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxLength(pSerialHead) - RxWIndex - 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; } else {&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxLength(pSerialHead) - RxWIndex;&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; }&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; if ( RxRIndex &amp;gt; RxWIndex ) {&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxRIndex - RxWIndex - 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; }&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; if ( RoomLeft ) {&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;&amp;nbsp;&amp;nbsp; pSerialHead-&amp;gt;DroppedBytesPDD +=&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pFuncTbl-&amp;gt;HWRxIntrHandler(pHWHead,&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RxBuffWrite(pSerialHead),&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;RoomLeft);&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; } else {&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;&amp;nbsp;&amp;nbsp; BYTE TempBuf[16];&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;&amp;nbsp;&amp;nbsp; RoomLeft = 16;&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;&amp;nbsp;&amp;nbsp; pFuncTbl-&amp;gt;HWRxIntrHandler(pHWHead,&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;&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;&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;&amp;nbsp;&amp;nbsp; TempBuf,&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;&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;&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;&amp;nbsp;&amp;nbsp; &amp;amp;RoomLeft);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would have thought that the RX handler would be passed the number of bytes to extract from the DMA memory and return how many it managed to read on that interrupt. Therefore I do not understand why it is a decrementing number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway it is clear that the Freescale i.MX28 Windows CE 6.0 BSP throws serial data away due to the above issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 18:56:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262153#M26464</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-02-26T18:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262154#M26465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Testing this a little further it seems the buffer pointer calculations made in mdd.c for the application serial port are incorrect. I need to try and understand a little more about the driver but running through with the debugger it seems that the receive buffer read pointer does not always keep up with the write pointer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the instance that the two are equal and not zero the calculation for buffer space remaining is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;RoomLeft = RxLength(pSerialHead) - RxWIndex;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Which is odd. If both pointers are the same and at say byte 2040 then it thinks that there is only 2048-2040 = 8 bytes available to use? Technically the whole buffer is available to use?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I will keep looking through the code but I assume this same driver code is cloned for other Freescale i.MX BSPs? Does anyone else see this issue?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Regards, Mark&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 14:23:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262154#M26465</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-02-27T14:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262155#M26466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Looking back at my debug output again you can actually see that after getting the serial bytes the Read and Write pointer values are updated but are the same:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;4491457 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=0,W=0&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;491907 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=409,W=409&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=409&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;4494129 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=818,W=818&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;4494753 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=1227,W=1227&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;4497799 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=1636,W=1636&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;4498068 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=2045,W=2045&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;4500466 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=0,W=0&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;4500906 PID:400002 TID:1a50006 After HWGetBytes, Fifo(&lt;STRONG&gt;R=409,W=409&lt;/STRONG&gt;,BA=0,L=2048) ByteRead=409&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;The problem seems to be the buffer space remaining calculation in mdd.c, which I have now found must originate from Microsoft as I have seen the same calculation in other BSPs.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&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; if ( RxRIndex == 0 ) {&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;&amp;nbsp;&amp;nbsp; // have to leave one byte free.&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxLength(pSerialHead) - RxWIndex - 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; } else {&lt;/P&gt;&lt;P&gt;&lt;STRONG&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxLength(pSerialHead) - RxWIndex;&lt;/STRONG&gt;&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; }&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; if ( RxRIndex &amp;gt; RxWIndex ) {&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxRIndex - RxWIndex - 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; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case where RxRIndex != 0 but RxRIndex == RxWIndex the calculation uses &lt;STRONG&gt;RoomLeft = RxLength(pSerialHead) - RxWIndex;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So each time the receive interrupt occurs the buffer R and W pointers are equal but incrementing. The space left does not account for a cyclic buffer and therefore is also decreasing on each received value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 14:49:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262155#M26466</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-02-27T14:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262156#M26467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems the issue with the i.MX28 serial port stems from the circular buffer calculations. These go back to early Microsoft code though so I am not sure why no one else has seen this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: blue;"&gt;if&lt;/SPAN&gt; ( RxRIndex == 0 ) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&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;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: green;"&gt;// have to leave one byte free.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxLength(pSerialHead) - RxWIndex - 1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;SPAN style="color: blue;"&gt;else&lt;/SPAN&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxLength(pSerialHead) - RxWIndex;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: blue;"&gt;if&lt;/SPAN&gt; ( RxRIndex &amp;gt; RxWIndex ) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&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;&amp;nbsp;&amp;nbsp; RoomLeft = RxRIndex - RxWIndex - 1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ‘Room Left’ variable is supposed to contain the buffer space remaining. RxLength is the buffer size, 2048. RxRIndex is the read index, and RxWIndex the write index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initially the R/W indexes are both 0 so I guess the R index is where to read from next and the W must be the last written byte?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that first instance RxRIndex is 0, so the first calculation is used = 2048 – 0 – 1 = 2047. This is how much buffer space is reported to the receive interrupt handler (i.e. you can get this many bytes from DMA into my buffer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After receiving some data the next time the receive interrupt fires both R and W indexes are the same but some other value depending on how many bytes came in last time. I.e. if 2000 bytes were received R and W would both be 2000. The calculation for space should still return 2047 (or 2048?) but the calculation uses:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RoomLeft = RxLength – RxWIndex = 2048 – 2000 = 48 bytes available in the buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The net result is that the available space calculation result is reduced until it is less than the next received chunk of data and some is thrown away.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last case above seems to cover when the read index is &amp;gt; than the write index. I.e. the write index has wrapped round beneath the read. This seems correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 15:15:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262156#M26467</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-02-27T15:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262157#M26468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks as though the PDD part of the driver in serialhw.c cannot accept a circular buffer which is now making me doubt that this is the intention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It uses a memcpy function to copy the bytes into the buffer which cannot account for rolling over the end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone has experience in the Serial mdd/pdd code I would appreciate some help!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 15:57:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262157#M26468</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-02-27T15:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262158#M26469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been going round in circles here (which interestingly is what the receive buffer is supposed to do!), but I am finally making sense of the Serial Receive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Serial data received by hardware under DMA&lt;/LI&gt;&lt;LI&gt;Interrupt gets data into what is supposed to be a circular buffer in mdd.c in the serial port structure moving on the write pointer if space is available&lt;/LI&gt;&lt;LI&gt;The higher level application gets data using the COM_Read function in mdd,c, probably called from the top level stream driver ReadFile function&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at the COM_Read function it moves the read pointer on as data is extracted by the higher level application / com control and wraps around the buffer if necessary. I.e. if the read pointer is at 2040 (of 2048) and 50 bytes come in, then COM_Read first copies out 8 bytes, then loops around the pointer and copies the remaining 42 leaving the read pointer back at the same location as the write pointer (assuming no more data has been received).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am now under the impression it is actually the pdd part of the driver that is at fault, which would make sense as I am sure there are loads of BSPs out there using the microsoft mdd part of the serial driver without error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two issues in the Freescale driver:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) If the received characters cause the buffer to roll round the receive gets the remaining characters to the end of the buffer first, resets the pointer to the beginning but &lt;STRONG&gt;does not return to collect the rest.&lt;/STRONG&gt; This is because mdd.c only grabs chars from the DMA buffer while there is an an interrupt to process but the receive interrupt status is clear on the second pass i.e. demonstrated as a 16-byte buffer below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15&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;&amp;nbsp;&amp;nbsp; R&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; W&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If 6 chars are received the first call gets 4 (into 12, 13, 14, and 15) but never returns to put two more at the beginning of the buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) The DMA handling in SL_RxIntrHandler (serialhw.c) toggles the DMA buffer used each time the function is called to extract data. So even if you did call back in to get the rest of the data it is now pointing at a different buffer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what I can see the SL_RxIntrHandler function needs to handle copying into the buffer in a circular fashion and keep copying until either the write pointer catches up with the read, or all the bytes received have been successfully copied.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will try and modify the code but I was wondering if anyone else has had this issue using the i.MX28 BSP?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 12:08:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262158#M26469</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-02-28T12:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262159#M26470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have looked at the i.MX51 BSP and although the SL_RxIntrHandler function has a different implementation it too expects 'Room Left' to be a linear region of memory (current write pointer to end of buffer) without handling an wrap-around.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SL_RxIntrHandler expects a pointer to the buffer and a length to read. Therefore the SL_RxIntrHandler does not know where the beginning of this buffer is to loop around. It can therefore only read the remaining bytes and it is up to the caller to then ask again for the remaining bytes after wrapping around its circular buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore I believe this will affect the i.MX51 and any other device supported in that BSP too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 14:00:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262159#M26470</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-02-28T14:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262160#M26471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks you for your so much input. Are your issues still there? If not, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Yixing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 07:25:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262160#M26471</guid>
      <dc:creator>YixingKong</dc:creator>
      <dc:date>2014-04-10T07:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262161#M26472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yixing,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another forum member sent me some code to use but I am not 100% confident in the fix as I do not understand how the two DMA buffers are intended to be used. It does appear to work in testing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did Adeneo write the BSP for these parts? Is it possible to obtain support for the BSPs from them? We plan to put this in a production product and we need reliability in the serial port comms.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 09:00:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262161#M26472</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-04-14T09:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262162#M26473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;William&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adeneo did not write BSP, instead works as supporter. You may contact Adeneo directly and ask details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As to DMA buffers, I may find an engineer from Freescale to help you in the question. But that engieer may answer you general DMA question, not Wince questions. Please put your DMA question here.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;&lt;P&gt;Yixing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 09:14:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262162#M26473</guid>
      <dc:creator>YixingKong</dc:creator>
      <dc:date>2014-04-14T09:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262163#M26474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please attach the code to this post so others can check it out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 20:40:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262163#M26474</guid>
      <dc:creator>JDFAE</dc:creator>
      <dc:date>2014-04-15T20:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262164#M26475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I finally got round to looking at the code for the serial port driver and I believe I have fixed the issue. From my testing I am now receiving all data (whether it wraps-around or not). There are still some parts of the driver I am not too sure about in terms of the decisions made by the original designer to implement the DMA in the way it currently is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to summarise the original issue - the Freescale-supplied Windows CE Application UART driver (C:\WINCE600\PLATFORM\COMMON\src\soc\COMMON_FSL_V2_PDK1_9\SERIALAPP\) does not handle wrapping of the MDD serial receive buffer. If more data is received than there is room at the top of the buffer for, then the additional wrapped data is thrown away. In a packet-based comms protocol this could mean partial packets are lost. With message retries this would potentially be hidden and still work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The receive is handled by the APBX DMA controller. The DMA command chain for the serial receive consists of two transfers that attempt to transfer the buffer size before generating an interrupt. If a small packet is received a time-out will generate the interrupt. The first DMA command in the chain copies data to buffer 0, the second one to buffer 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the second DMA command the chain is re-initialised (DMA commands reloaded). I am not sure why two DMA buffers are used - if there is enough time to re-initialise the DMA in the interrupt handler then a single buffer could be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem with the original code was caused by the implementation of the PDD part of the driver. The MDD will call into the PDD while the interrupt is to be processed. To handle buffer wrap-around we need to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;MDD - check the interrupt source by calling into the PDD function SL_GetIntrType - do not clear the status flags at this point&lt;/LI&gt;&lt;LI&gt;MDD - Calculate the space to the end of the buffer (ignoring wrap around)&lt;/LI&gt;&lt;LI&gt;PDD - Linearly copy as many bytes from DMA as we can get into the top of the buffer&lt;/LI&gt;&lt;LI&gt;PDD - Clear the interrupt flag if we copied them all and toggle / re-init the DMA&lt;/LI&gt;&lt;LI&gt;PDD - Leave the interrupt if the received bytes exceeds the top of buffer space and need to wrap-around - at this point we need to store how many bytes left to read and where in the DMA buffer to get them from&lt;/LI&gt;&lt;LI&gt;MDD - Move on the write pointer&lt;/LI&gt;&lt;LI&gt;MDD - see the interrupt is still set (for wrap) and recalculate space to read pointer&lt;/LI&gt;&lt;LI&gt;PDD - realise we are back in to collect more data from the previous attempt and copy the rest - then clear the interrupt flag&lt;/LI&gt;&lt;LI&gt;MDD - Move on the write pointer and signal to the read function that there is serial data available&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have implemented this as changes to the PDD. You can see my changes in the two functions: SL_GetIntrType() and SL_RxIntrHandler(). Use a diff tool with the original file for a true comparison. The MDD is the same as supplied.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The file to edit is:&lt;/P&gt;&lt;P&gt;C:\WINCE600\PLATFORM\COMMON\src\soc\COMMON_FSL_V2_PDK1_9\SERIALAPP\COM_PDD\serialhw.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will try and attach the code. I would appreciate it if anyone experiencing this issue could 'peer review' for me and let me know if there are any issues. I need to check how this handles errors in the serial data or overrun conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 11:35:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262164#M26475</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-05-19T11:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262165#M26476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Deactivated user, could you see if you could decide this DI can be closed?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Yixing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 06:19:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262165#M26476</guid>
      <dc:creator>YixingKong</dc:creator>
      <dc:date>2014-06-10T06:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262166#M26477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/karinavalencia"&gt;karinavalencia&lt;/A&gt;, could you see if you are able to find someone to help this one?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Yixing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 06:27:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262166#M26477</guid>
      <dc:creator>YixingKong</dc:creator>
      <dc:date>2014-06-10T06:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262167#M26478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;How is the progress of your issue after Adeneo's response? If it is resolved, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Yixing&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 07:27:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262167#M26478</guid>
      <dc:creator>YixingKong</dc:creator>
      <dc:date>2014-06-16T07:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262168#M26479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please do not close this issue yet as it is not resolved! I thought I had a fix but Adeneo have since commented.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that this appears to also be in your Compact 7 BSP in the common folder so probably affects your Windows CE serial receive for the i.MX28, i.MX51 and i.MX53 platforms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\WINCE700\platform\common\src\soc\COMMON_FSL_V3\SERIALAPP\COM_MDD2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I get Freescale to help resolve this issue? Serial transfer is pretty fundamental in an embedded application so really needs to be working in a reference BSP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 10:17:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262168#M26479</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-06-19T10:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262169#M26480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are having trouble with DMA, have you tried the driver with DMA support forced as disabled (set useDMA to FALSE in the function that normally sets it based off of a registry or register setting)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 14:38:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262169#M26480</guid>
      <dc:creator>codejingle</dc:creator>
      <dc:date>2014-06-19T14:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262170#M26481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately it won't make any difference. The MDD controls the circular buffer. Even if using direct serial port hardware a received length causing a MDD buffer circular wrap will throw away part of the packet that wraps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2014 11:22:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262170#M26481</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-06-20T11:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262171#M26482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been looking further into the SDMA implementation used by the serial port driver. It appears to work as follows (correct me if I am wrong):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The SDMA is set up in serialhw.c in the SL_Open() function initially, then in the SL_RxIntrHandler() function after completion of each DMA command chain.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The function SetupRXDescDESC() initialises a chain of commands in memory that is later passed to DDKApbxStartDma() function to load into the DMA registers. There are SERIAL_MAX_DESC_COUNT_RX (2) commands in the chain and a different RAM buffer used for the received data for each DMA command.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When serial data is received it triggers an SDMA command complete interrupt either through filling the buffer or a timeout condition (i.e. some data received but not enough to complete the SDMA command, after timeout the command is terminated so the data can be processed)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;On the first SDMA interrupt the data is collected and the pSerHead-&amp;gt;currRxDmaBufId set to 1 to flag to the PDD the second buffer is being used for the next interrupt&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;On the second SDMA interrupt the command chain is complete (just two commands). After extracting the data the pSerHead-&amp;gt;currRxDmaBufId is set to 0 and the whole DMA chain reinitialised. Presumably this means that while extracting data from the second command DMA buffer the DMA chain has no more commands to process and therefore any data received filling the UART hardware buffer will be lost until the DMA chain is reinitialised.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read the section on SDMA in the reference manual. Is it possible to set the second DMA command in the chain to point back to the first? I.e. after completing receiving data into the second buffer the command chain switches automatically back to receiving into the first buffer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like I would just need to change SetupRXDescDESC() to make the second command point back to the first so the two commands continually run in a loop without having to re-init the chain on completion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone provide and help or advice?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 14:02:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262171#M26482</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-06-24T14:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX28 Windows CE BSP Serial Port Bug Missing Received Data</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262172#M26483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Further to the above it looks like the usage of the semaphore counter may need to change. The DMA commands are set up to decrement the semaphore counter for the channel on completion. The DDKApbxStartDma() call sets the DMA counter to the number of commands in the chain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I was to implement a continuous loop of commands I presume I would need to clear the 'decrement semaphore' flag bit in the SetupRXDescDESC() function to prevent the DMA going idle on completion of the second DMA DESC so they loop forever. Is this ok to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 14:22:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX28-Windows-CE-BSP-Serial-Port-Bug-Missing-Received-Data/m-p/262172#M26483</guid>
      <dc:creator>markwilliams</dc:creator>
      <dc:date>2014-06-24T14:22:37Z</dc:date>
    </item>
  </channel>
</rss>

