cancel
Showing results for 
Search instead for 
Did you mean: 

USB to Serial data loss on STM32F777BIT6 (Works fine on Windows7, randomly loses data on Windows10)

harry anders
Associate II

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:

https://electronics.stackexchange.com/questions/425133/stm32-usb-cdc-packet-loss-with-active-pc-usage

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

9 REPLIES 9
Pavel A.
Evangelist III

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:

https://electronics.stackexchange.com/questions/425133/stm32-usb-cdc-packet-loss-with-active-pc-usage

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

Uwe Bonnes
Principal III

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.

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
Uwe Bonnes
Principal III

CTS/RTS handshake?

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

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.

I can't use that. CTS and RTS are being used for something else.

Robert_PS
Associate

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.

Oh, definitely not the same problem either. I don't see issues at such low data rates.

If you feel a post has answered your question, please click "Accept as Solution".