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