cancel
Showing results for 
Search instead for 
Did you mean: 

How to reach USB full speed data transfer?

morpeh89
Associate II
Posted on January 12, 2011 at 11:37

How to reach USB full speed data transfer?

2 REPLIES 2
tsuneo
Senior
Posted on May 17, 2011 at 14:21

> I can reach speed up to 128000 bit/s. If I understand properly, it's maximum speed, allowed by virtual COM port.

128000 bit/s = around 16K bytes/sec?

It's far from the max of CDC bulk IN/OUT.

CDC bulk endpoints can hit the max of the bulk transfer, as usual bulk EPs.

On the PC sold in these couple of years, you'll see 18 full-size transactions/  frame, without so much effort. On a quad-core PC, you may hit the theoretical max of full-speed bus (19 full-size transactions / frame).

full-size transaction (64 bytes) x 18 transactions / 1 ms USB frame

= around 1.1M bytes/sec

Maybe you are exchanging just 16 bytes packet on single transfer. It's the reason that you get such poor transfer speed. The transfer speed of bulk EP depends on the transfer size. Put greater-size transfer to get more speed. A transfer greater than full-size transaction (64 bytes) is split into multiple transactions on the device side. (host app put the entire transfer in single read/write call)

I've explained it on this topic.

Cortex-Mx STM32: Testing STM32 FS USB Library Performance

https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FARM%20CortexM3%20STM32%2FTesting%20STM32%20FS%20USB%20Library%20Performance

In above topic, I wrote of WinUSB. It is also applied to the CDC bulk endpoints. But there are a couple of CDC-specific matters.

On the device side,

CDC bulk IN transfer (device --> host) should always terminate with a short transaction (ie. less than 64 bytes). If a transfer finishes in full-size, the firmware has to add ZLP (Zero-Length Packet) to terminate the transfer.

On the host application,

Greater transfer size of Read call doesn't affect to the USB communication.  Read call accesses just to the internal input buffer on the class driver (usbser.sys). Instead, increase the size of internal buffer using SetupComm() (Windows serial API) or equivalent, so that it doesn't overflow.

SetupComm Function

http://msdn.microsoft.com/en-us/library/aa363439(VS.85).aspx

For Windows Vista and 7, you may download and apply the hotfix distributed on this MS page, for the update of usbser.sys (CDC PC driver on Windows).

XP SP3 has been already applied this hotfix.

''When you try to download a file from the Internet by using Internet Explorer, the download stops responding''

http://support.microsoft.com/kb/925681/en-us

Tsuneo

morpeh89
Associate II
Posted on May 17, 2011 at 14:21

Thank You, very much!

I have tested speed of my device more carefully: now I see speed about 5 Mbit/s (approximately), when device sends data to host.

Maybe, I will get higher speed, when study details.