cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2/4 USB HOST MSC transferrate improvements

tomaskrueger
Associate II
Posted on July 28, 2014 at 15:31

Good morning,

i am currently experimenting with the USB HOST MSC example as of Lib V2.1.0 .

I do have a custom hardware and managed to get the usb host msc example working.

At first i had attachment problems , io-problems etc.....which was caused by the USB_OTG_BSP_uDelay (uint32_t usec)  function being inaccurate in timing.

After tuning it to correct timing everything runs perfect.

Connecting a USB stick to the board i am getting the following speeds:

Read: ~780k bytes per second

Write: ~436k bytes per second.

I do not have deep insight of the usb stack as such and am wondering if that speed can get better.

in usb_conf.h there are some buffersizes defined:

 &sharpdefine RX_FIFO_FS_SIZE                          128

 &sharpdefine TX0_FIFO_FS_SIZE                          64

 &sharpdefine TX1_FIFO_FS_SIZE                         128

 &sharpdefine TX2_FIFO_FS_SIZE                          0

 &sharpdefine TX3_FIFO_FS_SIZE                          0

 &sharpdefine TXH_NP_FS_FIFOSIZ                         96

 &sharpdefine TXH_P_FS_FIFOSIZ                          96

 

Can these influence the transfer speed?

#usb-host-msc-transferrate
3 REPLIES 3
Posted on July 28, 2014 at 15:35

USB FS is 12 Mbps (Mega bits), so 800 KBps (Kilo bytes) might be the top end expectation. If you want MBps (Mega bytes) then use a MicroSD card

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tomaskrueger
Associate II
Posted on July 28, 2014 at 16:58

Hi Clive,

I overlooked that fundamental limitation of usb full speed being 1.5M bytes per second.

So i am pretty close with my values.

I could live with 800 k bytes per second on writespeed. (wonder why usbstick writes are slow, its a high speed stick).

Just another question on the usb stack:

It states that file io functionality (F_open,f_write etc)  shall be placed in the USBH_USR_MSC_Application(void) callback, which i find a bit inconvienient.

Will calls to file functions elsewhere in the program function as well?

Posted on July 28, 2014 at 17:27

I'd perhaps look at STM32F4-Discovery_FW_V1.1.0\Project\FW_upgrade

I'd recommend timing the Flash Stick on a PC with a USB 1.0 implementation.

Mass Storage devices are sensitive to both the size, and alignments of data transfers, especially writes, the blocks need to be large, and ideally coherent with the erase block size of the underlying memory. Implement caching and lazy-writing where you can.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..