Re: USB CDC driver?

=?Utf-8?B?Um9i?= <Rob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in

I wrote such a driver, used the printer sample as a starting
point. Basically it consists of 2 bulk pipes, and handling of the

For receiving you need a receive thread, reading bytes in a
blocking way, there is apperently no bufferring in the underlying
layers, so if you call read periodically, you will miss data.

I did more or less the same. It seems that the printer driver is a
very good template for USB drivers implementation :)

I think that the device-side buffering may be implemented only on
devices with a good amount of RAM (the amount of RAM needed depends
from the connection speed of the serial link), but, as you said, it's
safe to assume that there is no buffering.
You may handle it inside your own CDC driver.
You may also need to put some delays in the transmission code to avoid
to send too much data to the CDC device. USB link is usually faster
than the serial one and you may overflow the transmit buffer of your
CDC device if you try to transfer all the data at USB speed and the
receiving device does not provide a flow-control mechanism.
If you need to handle high-speed serial links you may consider an
implementation that uses asyncronous USB transfer to provide multiple
transfers to the USB host controller, allowing it to send and receive
data without the delay required by synchronous mode (your driver needs
to handle operation completition and provide new data to be sent or a
new receive buffer).

Valter Minute
Training, support and development for Windows CE
(the reply address of this message is invalid)

Relevant Pages