AnsweredAssumed Answered

Data dropout in VCP USB application

Question asked by bakker.huub on Jun 27, 2012
Latest reply on Jun 28, 2012 by bakker.huub
Hi,

I am working on a vibration sensor project where I need to send data from an accelerometer over USB to a computer application with a data loading of about 24 bytes per millisecond. I am using using a custom-built STM32 board that looks like an EVAL-C board (STM32F107) to the Atollic TrueStudio IDE I'm using.

On the software side, I have used the Virtual COM Port driver example as a starting point using the 3.3.0 OTG_FS library. I have used this code for about a year now in low-data-rate applications without any significant problems.

Everything works fine apart from the fact that I'm losing 16 bytes of data from the occasional (64 byte) packet and that the Tx FIFO then goes out of synch by one entry. That is, if I have data packets 1,2,3 etc that are sent in different frames and packet 1 loses 16 bytes, then packet 2 will not be sent until packet 3 is supposed to be sent, 3 not sent until packet 4 is supposed to be sent etc. If more packets drop data the Tx FIFO will go out of synch by one entry for each partially lost packet. The 16 bytes appear to be lost from the start of the packet.

Received packets are not affected and I can still talk to the STM. If I stop the transfers and ask it for a response it will send the next transfer off the FIFO, that being the transfer that was supposed to be sent n writes ago, where n is the numb of partially-dropped packets.

I have played about with the transfer size and this happens whether or not only one packet is sent per transfer, a full or partial packet is sent, or not. 

I am presuming that there is something that I have not implemented properly in altering the Virtual COM Port example but I have spent several days on this and, apart from knowing a lot more about USB that I did (or want to), have not managed to pinpoint the problem.

Any help or pointers would be very gratefully accepted.

regards
Huub

Outcomes