cancel
Showing results for 
Search instead for 
Did you mean: 

USB host MSC example

Stephan Scherer
Associate II
Posted on January 03, 2012 at 09:29

Hi everybody,

i work with the evalboard STM3220G with the USB example from the USB host-device lib.

I try to write additional data in the create/existing file, but I'm not successful.

Can anyone say me, what i must chance to solve that problem?
11 REPLIES 11
dcurran2
Associate II
Posted on January 06, 2012 at 15:59

Folks I dont know if anyone else spotted this but

if you compare the file usbh_msc_fatfs.* in the STM32F2XX examples and STM32F4XX code its different by this in

DRESULT disk_write ()

DRESULT disk_read ()

stm32f2xx

      status = USBH_MSC_Read10(&USB_OTG_Core, buff, sector, 512);

      status = USBH_MSC_Write10(&USB_OTG_Core,(BYTE*)buff, sector, 512);

stm32f4xx

      status = USBH_MSC_Read10(&USB_OTG_Core, buff, sector, 512*count);

      status = USBH_MSC_Write10(&USB_OTG_Core,(BYTE*)buff, sector, 512*count);

are you trying to manipulate lots of data ?

the stm32F4xx code was in the stm32f4

STM32F4XXX\stm32f4discovery_fw\STM32F4-Discovery_FW_V1.1.0\Libraries

where as stm32f2 code is the USB examples

Dan

infoinfo993
Associate
Posted on January 28, 2012 at 23:37

I wish I had seen your post before I spent a few hours chasing down this problem! I only found this post once I was about to post my own bug report.

The F4 version appears to be the correct one. You have to put that multiply by ''count'' in there, or reads and writes will not do more than 512 bytes, despite how many sectors were specified. I was reading a file 4K at a time and was only getting holes in the middle of each block where no data was read.

I haven't tested the write case yet, but the F4 version of the code seems to work fine for reads.