USB VCP Packet Loss with STM32L4R and Windows
Hello,
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!
Makarand