AnsweredAssumed Answered

USB-FS MSC Slow Writing Speed

Question asked by Mohammad Hossein on Mar 5, 2017
Latest reply on Mar 8, 2017 by Clive One

Hi,

I'm using STM32F4 as a USB Host for writing data to a mass storage (flash drive) in FS mode using CubeMX. As we know USB-FS nominal speed is 12Mbit/s and I set this speed in CubeMX for my application. However, the maximum writing speed that I reached is about 560 kbit/s!

I don't know what is the reason. Is there any special setting in FATFS,USB_FS or USB_Host configurations that affects  speed?

My code is similar to CubeMX example in repository,but I use FS Mode rather than HS used in example.

Is there anything important with preparing data buffer for writing (that affects speed)? My writing code is:

for(int16_t z=0;z<1024;z++)
{
sprintf(buf,"%5.5f,%5.5f\r\n",fbuf[z][0],fbuf[z][1]);
res = f_write(&MyFile, buf, strlen(buf), (void *)&byteswritten);
if((byteswritten == 0) || (res != FR_OK)) {
Error_Handler();

}
}

Thanks 

Outcomes