2020-09-16 02:27 AM
Hi,
I am using an STM32F777BIT6 in USB to Serial mode.
Everything works fine except for a random loss of data on the windows side.
After weeks of frustration I found the cause of this problem: Windows 10 CDC driver for virtual com ports. I tried the program on a windows 7 PC and it works without any data loss.
According to this link Changing the default CDC driver of windows 10 will solve the problem:
However, I have no idea how to find an alternate CDC driver for windows 10 and Google didn't help either. Does anyone have a link or know of such a driver?
Best wishes
2020-09-16 05:48 AM
By "Windows 10 CDC driver for virtual com ports" do you mean the Windows 10 in-box driver (if so, which version?) or ST or 3rd party driver?
Can you share more details? USB host controller model, any hubs in the middle?
> According to this link Changing the default CDC driver of windows 10 will solve the problem:
Sorry but I cannot find advice to change the host driver on that page. On the contrary, replies suggest some error on the STM32 side, such as sending data without proper sync, so the host does not keep up with the rate of data ?
-- pa
2020-09-16 06:11 AM
If you talk without protocoll, data loss can and will happen in some situations. Rate of error depends on USB implementation in the host, driver implementation in the host and processor capabilities. Either you can live with data loss and you resync or you work with a protocoll and the data source must eventuall discard data.
2020-09-16 06:28 AM
I spent a lot of time dealing with this issue when using HS USB. The solution for me was to send 16kB at a time and wait for a response from the computer before sending more. I could not find a way to avoid the data loss which occurred on the PC-side. The USB traffic showed that the STM32 was doing its job but the data was lost somewhere after making it to the computer but before making it to the program. Polling the port frequently reduces the occurrence.
If you find a better solution, please report it.
2020-09-16 06:52 AM
CTS/RTS handshake?
2020-09-16 06:58 AM
>By "Windows 10 CDC driver for virtual com ports" do you mean the Windows 10 in-box driver (if so, which version?) or ST or 3rd party driver?
Can you share more details? USB host controller model, any hubs in the middle?
Yes the in-box windows 10 driver. ST driver doesn't work either. No Hubs in the middle. Direct connection. This is a Windows 10 problem. A lot of other people are reporting this in Windows 10.
>Sorry but I cannot find advice to change the host driver on that page.
See the second response. He says he used another driver and it fixed the problem. Problem is he doesn't say what driver.
2020-09-16 06:58 AM
I can't use your solution because I'm using a simple program that recieves 250 bytes from the PC and replies with 5 bytes. This is repeated in 20ms intervals. Baudrate is about 9600.
I tried everything. Nothing worked except using windows 7 instead of 10.
2020-09-16 07:02 AM
I can't use that. CTS and RTS are being used for something else.
2020-09-17 08:09 AM
USB CDC uses bulk transfer which means that (if everything is working according to spec) there should not be any loss of data. Do you have the means to check if all packages are acknowledged by the host?
If everything works as expected on the physical layer, but you still lose data then it could be a driver bug. We suspect there is one in USBser.sys and have a workaround in place to limit communication to 1 packet per USB frame containing at most 63 bytes. There is probably a SOF interrupt/callback/handler that can be used.
2020-09-17 08:28 AM
Oh, definitely not the same problem either. I don't see issues at such low data rates.