<?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 Error in serial data on a USB CDC in win10 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Error-in-serial-data-on-a-USB-CDC-in-win10/m-p/705433#M28416</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following query is also asked in &lt;A href="http://social.msdn.microsoft.com"&gt;http://social.msdn.microsoft.com&lt;/A&gt;. Repeating the same if anyone has already experienced this and could help me to an extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This issue appears with our products while transmitting picture from a NXP's L&lt;SPAN lang="EN-GB"&gt;PC4333JBD144 μC using a virtual COM port (i.e., USB CDC). The issue is observed only on Windows 10 and not on Windows 7.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;For reference the following are the pictures with the error in data read by the host application on a Windows 10 platform.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" /&gt;&lt;IMG alt="" src="https://social.msdn.microsoft.com/Forums/getfile/1114001" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the received pictures, I can see 3 different patterns:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Black pattern&lt;/LI&gt;&lt;LI&gt;Random noise pattern&lt;/LI&gt;&lt;LI&gt;Shifted pattern&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To reproduce this issue, I created a sample project on LPCXpresso on the device side and a C# project on the host side.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device side:&lt;/STRONG&gt;&lt;BR /&gt;Project based on LPCOpen example '&lt;SPAN lang="EN-GB"&gt;lpcopen_2_19_lpcxpresso_ngx_xplorer_4330'. - When the μC receives char '0', it sends back the data size it will transmit (225792 for my example) as a UINT32 (4 bytes) - When the μC receives char '1', it sends back 225792 bytes by packet of 256 bytes each. Each 256 bytes follow this pattern: 0x00, 0x01, ... , 0xFF.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB"&gt;&lt;STRONG&gt;Host side:&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB"&gt;Initially I developed the host application using .NET SerialPort object with the help of &lt;/SPAN&gt;&lt;SPAN&gt;DataReceived event to receive the data from the COM port. With this I could easily simulate the issue with lots of errors while reading data. Then with the reference from various blogs (especially from &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.sparxeng.com%2Fblog%2Fsoftware%2Fmust-use-net-system-io-ports-serialport" rel="nofollow" target="_blank"&gt;http://www.sparxeng.com/blog/software/must-use-net-system-io-ports-serialport&lt;/A&gt;&lt;SPAN&gt;), I switched to method SerialPort.BaseStream. Then the issue seem to be less frequent, but still I could see issue rarely though.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To detect an error, I count the number of times I receive the 256 byte pattern (0x00, 0x01, ...&amp;nbsp; ,0xFF) on a full reception. If it isn't equal to the expected number (..which is 225792 / 256 = 882), then I create a log with the error data into data.txt in the same directory. The conditions for a full reception is either receiving 225792 bytes or a timeout of 1 second.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have monitored the packet in the USB PHY using USB protocol suite (Teledyne Lecroy Mercury T2) and I didn't find any transmission error that is observed by the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I come to a conclusion that the issue seem to be very specific to Windows 10 + USB CDC while reading the data using SerialPort object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did anybody already experience this&amp;nbsp;behavior?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source code for testing can be found here: &lt;A href="https://github.com/AlecG74/cdc_com_test"&gt;https://github.com/AlecG74/cdc_com_test&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tested on Windows 10 Professional 64bit version: 1703-15063.540&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Follow-up in the Microsoft MSDN:&amp;nbsp;&lt;A class="link-titled" href="https://social.msdn.microsoft.com/Forums/en-US/wdk/thread/ade57269-1dbe-4a15-a1a1-54f60a1b99b4/#411f76af-8c3f-4349-9dd8-491df419fd3b" title="https://social.msdn.microsoft.com/Forums/en-US/wdk/thread/ade57269-1dbe-4a15-a1a1-54f60a1b99b4/#411f76af-8c3f-4349-9dd8-491df419fd3b"&gt;BUG Report - COM-Port over CDC (usbser)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Aug 2017 13:00:09 GMT</pubDate>
    <dc:creator>thillaielayaraj</dc:creator>
    <dc:date>2017-08-23T13:00:09Z</dc:date>
    <item>
      <title>Error in serial data on a USB CDC in win10</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Error-in-serial-data-on-a-USB-CDC-in-win10/m-p/705433#M28416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following query is also asked in &lt;A href="http://social.msdn.microsoft.com"&gt;http://social.msdn.microsoft.com&lt;/A&gt;. Repeating the same if anyone has already experienced this and could help me to an extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This issue appears with our products while transmitting picture from a NXP's L&lt;SPAN lang="EN-GB"&gt;PC4333JBD144 μC using a virtual COM port (i.e., USB CDC). The issue is observed only on Windows 10 and not on Windows 7.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;For reference the following are the pictures with the error in data read by the host application on a Windows 10 platform.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" /&gt;&lt;IMG alt="" src="https://social.msdn.microsoft.com/Forums/getfile/1114001" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the received pictures, I can see 3 different patterns:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Black pattern&lt;/LI&gt;&lt;LI&gt;Random noise pattern&lt;/LI&gt;&lt;LI&gt;Shifted pattern&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To reproduce this issue, I created a sample project on LPCXpresso on the device side and a C# project on the host side.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device side:&lt;/STRONG&gt;&lt;BR /&gt;Project based on LPCOpen example '&lt;SPAN lang="EN-GB"&gt;lpcopen_2_19_lpcxpresso_ngx_xplorer_4330'. - When the μC receives char '0', it sends back the data size it will transmit (225792 for my example) as a UINT32 (4 bytes) - When the μC receives char '1', it sends back 225792 bytes by packet of 256 bytes each. Each 256 bytes follow this pattern: 0x00, 0x01, ... , 0xFF.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB"&gt;&lt;STRONG&gt;Host side:&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-GB"&gt;Initially I developed the host application using .NET SerialPort object with the help of &lt;/SPAN&gt;&lt;SPAN&gt;DataReceived event to receive the data from the COM port. With this I could easily simulate the issue with lots of errors while reading data. Then with the reference from various blogs (especially from &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.sparxeng.com%2Fblog%2Fsoftware%2Fmust-use-net-system-io-ports-serialport" rel="nofollow" target="_blank"&gt;http://www.sparxeng.com/blog/software/must-use-net-system-io-ports-serialport&lt;/A&gt;&lt;SPAN&gt;), I switched to method SerialPort.BaseStream. Then the issue seem to be less frequent, but still I could see issue rarely though.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To detect an error, I count the number of times I receive the 256 byte pattern (0x00, 0x01, ...&amp;nbsp; ,0xFF) on a full reception. If it isn't equal to the expected number (..which is 225792 / 256 = 882), then I create a log with the error data into data.txt in the same directory. The conditions for a full reception is either receiving 225792 bytes or a timeout of 1 second.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have monitored the packet in the USB PHY using USB protocol suite (Teledyne Lecroy Mercury T2) and I didn't find any transmission error that is observed by the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I come to a conclusion that the issue seem to be very specific to Windows 10 + USB CDC while reading the data using SerialPort object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did anybody already experience this&amp;nbsp;behavior?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source code for testing can be found here: &lt;A href="https://github.com/AlecG74/cdc_com_test"&gt;https://github.com/AlecG74/cdc_com_test&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tested on Windows 10 Professional 64bit version: 1703-15063.540&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Follow-up in the Microsoft MSDN:&amp;nbsp;&lt;A class="link-titled" href="https://social.msdn.microsoft.com/Forums/en-US/wdk/thread/ade57269-1dbe-4a15-a1a1-54f60a1b99b4/#411f76af-8c3f-4349-9dd8-491df419fd3b" title="https://social.msdn.microsoft.com/Forums/en-US/wdk/thread/ade57269-1dbe-4a15-a1a1-54f60a1b99b4/#411f76af-8c3f-4349-9dd8-491df419fd3b"&gt;BUG Report - COM-Port over CDC (usbser)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Aug 2017 13:00:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Error-in-serial-data-on-a-USB-CDC-in-win10/m-p/705433#M28416</guid>
      <dc:creator>thillaielayaraj</dc:creator>
      <dc:date>2017-08-23T13:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error in serial data on a USB CDC in win10</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Error-in-serial-data-on-a-USB-CDC-in-win10/m-p/705434#M28417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;We have created a win32 command line tool with a similar functionality.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;We could also simulate the issue with it (but we need to wait for a long time as it is slower).&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;Source code has been added to the same git location. &lt;A href="https://github.com/AlecG74/cdc_com_test"&gt;https://github.com/AlecG74/cdc_com_test&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;&lt;STRONG&gt;Description of the win32 tool&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;In the win32 application, we have created a custom class named CSerialport which implements the serial port functions like open (), read () and write () using the CreateFile().&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;This tool functions very similar to the .NET based application to use it with the target hardware. It sends char '0' to get the data size and sends char '1' to get the data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;Chunks of 512 bytes are appended to the &lt;EM&gt;data&lt;/EM&gt; array. When transaction is finished, each received chunk are compared with a fixed 512 bytes pattern that was stored in &lt;EM&gt;test&lt;/EM&gt; array.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;With this custom class, using &lt;EM&gt;CreateFile&lt;/EM&gt; function, the reception is slower in win10 and even more on win7.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt; Though we haven't seen specific patterns like zeros or random values, we could see shifting of data similar to the .Net application.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 11.0pt;"&gt;Current status&lt;/STRONG&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="color: #000000; text-decoration: underline;"&gt;&lt;EM style="font-size: 11pt;"&gt;.Net tool using SerialPort or SerialPort.BaseStream&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="color: #000000;"&gt;I&lt;SPAN style="font-size: 11pt;"&gt;ssue exist with win10&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #000000; font-size: 11pt;"&gt;No issue with win7 &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; text-decoration: underline; font-size: 11pt;"&gt;&lt;EM&gt;win32 tool&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="color: #000000; font-size: 11pt;"&gt;Issue exist with win10&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-size: 11pt;"&gt;No issue with win7&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;STRONG style="color: #000000;"&gt;&lt;SPAN style="font-size: 11pt;"&gt;So we believe it is an issue with windows CDC driver implemented in windows 10.&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;STRONG style=": ; color: black; font-size: 11.0pt;"&gt;&lt;BR /&gt;Platform versions used for testing:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;Windows 10 Professional 64bit&lt;SPAN&gt;: 1703 (15063.540) with target .NET framework 4.6.2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin: 0in 0in 12.0pt 0in;"&gt;&lt;SPAN style="font-size: 11.0pt; color: black;"&gt;Windows 7 Professional 64 bit: SP1&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Sep 2017 05:45:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Error-in-serial-data-on-a-USB-CDC-in-win10/m-p/705434#M28417</guid>
      <dc:creator>thillaielayaraj</dc:creator>
      <dc:date>2017-09-22T05:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error in serial data on a USB CDC in win10</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Error-in-serial-data-on-a-USB-CDC-in-win10/m-p/705435#M28418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did anyone came across such an issue and possibly can guide us with a way to overcome the same? Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Oct 2017 07:59:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Error-in-serial-data-on-a-USB-CDC-in-win10/m-p/705435#M28418</guid>
      <dc:creator>thillaielayaraj</dc:creator>
      <dc:date>2017-10-09T07:59:37Z</dc:date>
    </item>
  </channel>
</rss>

