cancel
Showing results for 
Search instead for 
Did you mean: 

USB MSC Host issues

mjscott
Associate II
Posted on March 26, 2013 at 14:43

I'm using an STM32F105VC Z; the hardware design is about a year old and has worked fine with the exception MSC flash recognition. The MSC system software is based on the OTG 2.1 and HOST libraries and the MSC example. When I first started debugging the USB flash I was using an 8 Gig FAT32, the system would not enumerate it. Look over the code and everything looked right (verified clock speeds, I/O configuration bits, etc), tried the STM32F105/107 USB Host IAP app and got the same thing. I tried a 4 Gig FAT flash and it work perfectly. Now the system needs to work with all thumb drives, so I started debugging again. I have the original flash which still works fine, I tried another 4 Gig flash with FAT32, it will enumerate, gets into the MSC class code and will not call the user app. Tried another 4 Gig FAT32 (sent with my ST 207 development board) it will enumerate and gets stick in the MSC class code. Tried another 4 Gig FAT flash it will recognize the drive but will not enumerate it, gets stuck in the host enumeration, reads the first 8 bytes but never completes the read description. Here is where it gets really strange, if I stop the debugger in the Host Enumeration code and single step it, 1 out of ten times it will enumerate. On the drives that enumerate if I stop the code in the usbh_msc_bot  code and halt it in USBH_MSC_DECODE_CSW 1 out of every ten times it will get through the class code and read the disk (all of them do this). Seems like a speed issue, verified the USB clock and everything is right. If I add a 250 msec delay in the USBH_MSC_DECODE_CSW code it will make it though msc class all the time and will read the files, all-be-it very slowly (much slower then the 4 Gig FAT flash that always worked).  

Now this is where it gets a little stranger, I have another project using the STM32F207 G development board, using the ST demonstration builder code I can read any (ANY) flash drive I plug in. Demonstration builder is based on the same OTG and HOST libraries and FATFs code. It is also running FreeRTOS. When I do a file compare between the files I’m using with the F105 and the ones for the F207 they are identical.

If anyone has solved this with the F105 let me know what your experience has been.

1 REPLY 1
mjscott
Associate II
Posted on March 27, 2013 at 12:41

Problem found, you all may want to take note of this.

The errata for the STM32F105 Z silicon states a number of USB FS OTG flaws which require either a specific sequence of instructions or the avoidance of specific sequences of instructions. The ST USB OTG library is relying on the C compiler to create or avoid these sequences, big mistake.

I would recommend that ST include assembly language patches to assure that their library code actually works when dealing with flawed silicon workarounds.