/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / How to achieve higher USB data rates?

Username:     
Password:     
             

Forum

# 1   2010-09-05 12:32:11 How to achieve higher USB data rates?

VanKurt
Member
Registered: 2010-08-12
Posts: 10

How to achieve higher USB data rates?

Hi there!
I finally got Primer2 - PC communication via USB to work :-)
Now I'm trying to increase the data rates. Currently I use the following send code:

while (1)
  {
    USB_SIL_Write(EP1_IN, myDataArray, 64);
    SetEPTxValid(ENDP1);
   
  }

( the whole RIDE project is basically taken from the virtual COM port sample from STM).
On the PC I read in the data and measure the data rate. Usually I get ~20 kb/s.

Since the Primer2 should have a full speed USB 2.0 controller I expected something in the range of 1500 kb/s. So obviously something is going wrong here...

Has anyone an idea how I could fix this?
Boris

Offline

 

# 2   2010-09-06 07:42:36 How to achieve higher USB data rates?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: How to achieve higher USB data rates?

Effectively, the STM32 comes with a 12 Mb/s full speed USB peripheral, but by experience, it's difficult to overrun about 250 Kb/s, with small packets on several endpoints.
USB is optimized for unidirectional large data packets.
To reach the best performance it is recommand to merge data into the same packet, so into the same endpoint, and to limit switches between input and output requests.
The performance also depends on PC platform and even on PC USB port, that can be very different between two ports on the same PC.

Which type of Endpoint did you set to EP1 (interrupt, bulk...) ?

Offline

 

# 3   2011-04-07 07:41:08 How to achieve higher USB data rates?

pfandler
Member
From: Hungary
Registered: 2011-02-16
Posts: 26

Re: How to achieve higher USB data rates?

Hello,

I can confirm Boris's message about the very slow USB speed. I plugged a microSD into the Evoprimer/E, and then connected to the pc with an USB cable. Then I started the USB / PC program from the factory menu. I use the newest 4.11 OS.

I copied mp3 files from the PC onto the SD card, and the speed was 25 kilobytes / s. I quickly canceled the copy operation and plugged the same SD card directly into the PC to upload the files. This way I reached a speed of 8,5-9 megabytes / s. This means, if I plug the SD into the primer, i get 340-360 times slower USB speed than with the SD card reader.

What's the reason for that?

I ask this because 25 kbytes / sec = 200 kbits / sec, and ST claims that the MCU supports an USB speed of 12 Mbits / sec which is 60 times faster.

Last edited by pfandler (2011-04-07 07:41:54)

Offline

 

# 4   2011-04-07 15:45:06 How to achieve higher USB data rates?

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: How to achieve higher USB data rates?

USB Full-speed mode with 12Mbit/sec is only reference for internal clocking. Actual bit transfer speed is about 15% slower because of bit stuffing - a process that ensures stable signal frequency by recoding data from 6 bits to 7. Usual packet transfer requires additional 20 bytes of sync and header info and this number increases if you are using several hubs in chain between your device and PC.

I managed to archieve transfer speed of ~500Kbit/sec on (Atmel) AT90UBS162 using a handwritten highly specialized MCU code and windows driver. I think it's possible to transfer data even faster with STM32, but not using ST provided USB stack.

In short: to get more speed you need to code it completely by yourself with application in mind.

2 pfandler: Your card reader probably uses USB High speed which has signaling of 480Mbit/sec. This number is far beyond any frequency supported by STM32. If you need a high speed data transfer consider using a specialized chips for SD-card <-> USB-MSD with external control from MCU.

Offline

 

# 5   2011-04-08 06:27:25 How to achieve higher USB data rates?

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: How to achieve higher USB data rates?

For your information, the next family of STM32 (STM32F2xx) will embed USB OTG High Speed, and we are working on a EvoPrimer target board that uses it.

Offline

 

# 6   2011-04-08 07:51:04 How to achieve higher USB data rates?

pfandler
Member
From: Hungary
Registered: 2011-02-16
Posts: 26

Re: How to achieve higher USB data rates?

Well, that's great news! I hope it will be soon available!

Offline

 

Board footer