cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_USB-Host-Device_Lib_V2.1.0 (MSC issues)

Posted on March 27, 2012 at 15:23

Hi,

I'm using the USB-Host (MSC class) library to read/write USB flash drives with STM32F105/107. I've the STM3210C-EVAL board to try the example bundled in the official package (compiled with MDK-ARM, but also with bare-bone Codesourcery GCC -> same results).

USB Host MSC example -> used with 3 different USB flash drives

Lexar JDFF4GB-00-5015

VID: 05DCh

PID: A781h

Manufacturer : Lexar

Product: JD FireFly

Transcend JF V30/2GB

VID: 058Fh

PID: 6387h

Manufacturer : JetFlash

Product: Mass Storage Device

Transcend TS128MJF2A

VID: 0C76h

PID: 0005h

Manufacturer : JetFlash

Product: TS128MJF2A

All USB drives enumerate, but

only

in the Lexar one the f_mount / Explore_Disk demo execute successfully, in other two devices the functions

hangs

.

I've tried ''STM32_F105-07_F2xx_USB-Host-Device_Lib_V2.0.0'' too, same target, same compilers (MDK-ARM and bare-bone Codesourcery GCC). With that library I've got better results, only the Transcend TS128MJF2A device hangs.

Seems that LibraryV2.0.0 works better with STM32F105/107 target.

Best Regards,

Luca

#usb-host #usb-msc-mass-storage #usb-device-msc-code-sourcery #stm32-usb-library #usb-host
8 REPLIES 8
alok472
Associate II
Posted on March 28, 2012 at 03:19

What is the file format on other 2 usb disks which do not mount ? The Host library uses free file system for FAT16/FAT32. Maybe you formatted the other 2 disks on a diferent file system causing the File system to get confused and Hang.

Can you re-format these 2 usb disks on WIN-XP or other OS and then try to mount the drives on host lib ?

i am using host lib, didnt face problem with several usb disks.

Posted on March 28, 2012 at 10:34

Hi alokm,

all pendrives are formatted with FAT (16/32) filesystem.

Reformatted the Transcend TS128MJF2A one (this device doesn't work either in library 2.0.0 or 2.1.0) , but with no success ....

One curious thing I noticed : if I plug

first

the Lexar device, let the demo firmware

only

enumerate it, then unplug Lexar and connect the Transcend TS128MJF2A device, it works ! (both mount and file explorer)

Resetting board, plug Transcend TS128MJF2A, enumerate OK, mount/file explore fails.

This is really odd ...

alok472
Associate II
Posted on March 28, 2012 at 19:25

TS128MJF2A means 128 MB ?

Just a seemingly stupid question. WHich is the OS on PC which you used for formatting the USB Disks ? Is it by change Win7 ? Do you have Win-XP ?

Is it possible to format with another PC and Try ? (it may sound stupid since FAT16/32 is shown....but worth a try)

Do you have by chance USB analyser to capture the transactions between STM32 and usb disk ?

When Lexar disk is removed, is it detected by stm32 ?

Posted on March 29, 2012 at 09:47

Yes, TS128MJF2A is an old 128 MB pendrive.

For the OS ''format'' question : I used Windows 7 (I don't have a WinXP atm) and even Linux (latest Ubuntu with his disk manager) to delete/re-partition/re-format pendrive.

Note : like I said in the first post, with previuos library (2.0.0) the Transcend JF V30/2GB works very well (also FAT-formatted with linux).

The TS128MJF2A pendrive hangs in mount/file explorer with library 2.0.0, library 2.1.0, formatted with Win7 or Linux. It works only with the ''trick'' described above.

Unfortunately I don't have a USB analyser, so I cannot capture transactions with an external device.

When I remove Lexar and the old 128M pendrive is plugged, it works very well. If I repeat the sequence many times (plug

first

Lexar and then TS128MJF2A) without resetting the STM32 it works too.

jlchoobs
Associate II
Posted on May 24, 2012 at 21:27

STM32_USB-Host-Device_Lib_V2.1.0 (MSC issues) - with Code Sourcery

Luca,

I have been using the Stm32 Host Device Lib V2.1.0 MSC with the STM32 with no problems with the Usb FlashDrives.  I have been compiling using Atollic.

I tried compiling it using the Code Sourcery - but I dont think I loaded the above Project correctly.

What setup did you use for the Code Sourcery - none of the directories specify Code Sourcery? (so I used the Atollic dir/project) 

But when I build - it just says 'nothing to compile'.

I can compile other STM32 Projects on the Code Sourcery though - so Code Sourcery is setup right.  I just cant configure the Stm32 Host Device Lib V2.1.0 MSC Project.

How did you load/configure it on Code Sourcery ?

Posted on June 18, 2012 at 17:08

Hey jlsilicon,

sorry for this reply delay, check the file in attachment.

It is my GCC/CodeSourcery workspace directory (used with barebone compiler and makefile). Just modify the makefile with your paths.

I hope that helps !

Regards,

Luca

________________

Attachments :

STM3210C_EvalGCC_USBMSC.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtWw&d=%2Fa%2F0X0000000aRL%2FWUPRFrjJS7heeWFLrpvnbcj7pIEvBGlnygZ2wdkNpBc&asPdf=false
Posted on June 19, 2012 at 09:15

try changing in usbh_conf.h

#define USBH_MAX_NUM_ENDPOINTS                2

to

#define USBH_MAX_NUM_ENDPOINTS                3

I hope it is

useful

Paolo

Posted on July 26, 2012 at 10:10

Dear Paolo,

I'm back to my USB-Host activity (after a month in another project)...

 

Your advice was very helpful, now all my USB pendrives seem to work correctly !

Thank you,

Luca