Error in serial data on a USB CDC in win10

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error in serial data on a USB CDC in win10

2,312 Views
thillaielayaraj
Contributor II

Hello,

The following query is also asked in http://social.msdn.microsoft.com. Repeating the same if anyone has already experienced this and could help me to an extent.

This issue appears with our products while transmitting picture from a NXP's LPC4333JBD144 μC using a virtual COM port (i.e., USB CDC). The issue is observed only on Windows 10 and not on Windows 7.

For reference the following are the pictures with the error in data read by the host application on a Windows 10 platform.

On the received pictures, I can see 3 different patterns:

  • Black pattern
  • Random noise pattern
  • Shifted pattern

To reproduce this issue, I created a sample project on LPCXpresso on the device side and a C# project on the host side.

Device side:
Project based on LPCOpen example '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.

Host side:
Initially I developed the host application using .NET SerialPort object with the help of 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 http://www.sparxeng.com/blog/software/must-use-net-system-io-ports-serialport), I switched to method SerialPort.BaseStream. Then the issue seem to be less frequent, but still I could see issue rarely though.

To detect an error, I count the number of times I receive the 256 byte pattern (0x00, 0x01, ...  ,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.

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.

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.

Did anybody already experience this behavior?

Source code for testing can be found here: https://github.com/AlecG74/cdc_com_test

Tested on Windows 10 Professional 64bit version: 1703-15063.540

Follow-up in the Microsoft MSDN: BUG Report - COM-Port over CDC (usbser) 

Labels (4)
0 Kudos
2 Replies

1,518 Views
thillaielayaraj
Contributor II

Did anyone came across such an issue and possibly can guide us with a way to overcome the same? Thanks in advance.

0 Kudos

1,518 Views
thillaielayaraj
Contributor II

We have created a win32 command line tool with a similar functionality.

We could also simulate the issue with it (but we need to wait for a long time as it is slower).

Source code has been added to the same git location. https://github.com/AlecG74/cdc_com_test

Description of the win32 tool

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().

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.

Chunks of 512 bytes are appended to the data array. When transaction is finished, each received chunk are compared with a fixed 512 bytes pattern that was stored in test array.

With this custom class, using CreateFile function, the reception is slower in win10 and even more on win7.

Though we haven't seen specific patterns like zeros or random values, we could see shifting of data similar to the .Net application.

 Current status

.Net tool using SerialPort or SerialPort.BaseStream

  • Issue exist with win10
  • No issue with win7


win32 tool

  • Issue exist with win10
  • No issue with win7

So we believe it is an issue with windows CDC driver implemented in windows 10.


Platform versions used for testing:

  • Windows 10 Professional 64bit: 1703 (15063.540) with target .NET framework 4.6.2
  • Windows 7 Professional 64 bit: SP1
0 Kudos