Showing results for 
Search instead for 
Did you mean: 

USB VCP Packet Loss with STM32L4R and Windows

Associate II


I have an STM32L4R9ZI controller connected to a computer running Windows 10. I have a custom protocol where the computer sends a command and my controller responds. I am using VCP to achieve this. The communication is established and operational. For some tests I require to send out commands and get responses continuously for days. The typical rate of communication is 5 commands a second. Every command contains a maximum 20 bytes and a response may contain up to 50 bytes.

While testing I have been facing issues when a response is not received by the PC and my test scripts fail. I have been trying to find out on forums about solving this problem and few articles point me towards a windows 10 driver issue in particular. 

However, I am not sure whether:

1. It is the controller that does not receive the command to respond (PC did not send it) - This may not be the problem as some of the commands suggest that internal memory of my controller is written as a result of the command and hence it was sent out by the PC.

2. Controller did not respond - Would this be a problem that the controller sometimes does not respond? I use the CDC_Transmit_FS function to send out data. 

3. Controller responded but PC did not receive it. It is python scripts that read my data out. I see the script timing out on the serial read. 

This problem is very random. Sometimes I have seen it happen several times a day and sometimes my tests for 5 days have completed successfully. It happens on different commands so I am not attributing it to a single command being incorrectly coded. 

Request for help with regards to how to solve / debug this please. I was thinking about using if there are any USB analyzers / sniffers. 

I thank you in advance!



Pavel A.
Evangelist III

few articles point me towards a windows 10 driver issue 

Win10 driver issue? Any link or reference, please? 

I was thinking about using if there are any USB analyzers / sniffers. 

A good idea. With a quality logging tool and automation. This already comes close to a professional-grade testing harness.

Arrange your commands and responses to be more helpful (add, for example, sequence numbers or other means to help detecting anomalies).


Thank you for the collection of references. I remember the last one, on the MSDN forum. Since no convincing repro had been provided (and the Windows dept. used to do a good QA then) these few reports were caused by bugs in device firmware for STM32 or other popular MCUs. It's unlikely a genuine bug in Windows usbser or USB core.

As for USB analyzer.... I have a very aged Ellisys. Hesitate to recommend it. Try "Hardware recommendations" on Stack overflow.