cancel
Showing results for 
Search instead for 
Did you mean: 

Suggestion for USB MSC HOST on F7-Disco

tm3341
Associate II
Posted on August 03, 2015 at 18:25

Hello,

I'm building USB MSC HOST implementation library from stack provided in CubeF7 v1.1.0 series. I successfully fixed a bug with comparison for timeout and I got it working far quickly for first time.

I took Application examples from CubeF7 for USB MSC Host and copy/paste things to my project. Again, quite fast successful.

Then, I checked how to use this in main file how to mount USB and worked OK.

File was written and text also to USB. Checked on PC and file is there. Great.

Then, I tried with another USB flash key, and there is funny thing:

1. Mounted is OK (f_mount returns FR_OK)

2. File is opened OK (FA_OPEN_ALWAYS | FA_WRITE | FA_READ)

3. f_puts said that characters are written to file.

4. File is closed OK (At least should be)

5. On some USB FLASH KEY, FR_NOFILE is returned when trying to reopen (With opening mode FA_READ | FA_WRITE) file and there is actually no file on USB, no matter what they returned on f_open and f_puts.

   On some works OK.

All USB flash keys were all formatted in different configurations (But all of them always the same when testing) for testing and write was OK always on the same.

So, I checked again ST example for MSC HOST, trying there the same KEY which didn't work on my example and there it worked OK.

So my question here for ST USB STACK developers.

Where should I look for error like this?

FATFS implementation is OK because it works on some of flash keys.

I'm using HS mode with external ULPI PHY.

PS: Library is built for F4 and F7 series (For F4 I took F429 Discovery with embedded PHY). There I got the same behaviour and have no idea why.

USB Conf is technically copy/paste from example on ST, except added is support for HA and FS modes at the same time if needed. This was checked and HS and FS modes are handled properly. I also enabled/disabled DMA for USB to test and always the same behaviour.

Another problem I have, is that when CACHE is enabled on F7 series, USB HS mode does not work. Again, where should I take a look for this problem? Not enabling cache on the beginning of main function works just OK.

I can send project if needed (working with Keil uVision). Clock configuration is the same as on example.

One of USB flash keys where this does not work is the one I got from STM32F439-EVAL board.

Below is image from my LOG on LCD I made by myself.

I hope we will find solution for this problem.

Edit: I've enabled FS mode also and I got the same behaviour. First it says that file is opened when I open it using FA_OPEN_ALWAYS mode and that string is written, but file is not on USB.

0690X00000603PsQAI.jpg

#stm32f7-stm32f4-usb-msc-host
4 REPLIES 4
tm3341
Associate II
Posted on August 04, 2015 at 08:35

So, I moved forward with research, With USB debug enabled, I found that on devices where file ''is created'' but actually does not exists, HOST MSC stack fails with getting capacity.

Check bottom images, on one it works OK, second does not work.

I'm waiting for your responses ST developers. And BTW..this USB key which does not work here, works on official example without problems, so I must fail somewhere but don't know where should I look. Everything looks the same as in example.

Looking at code, I found that function USBH_MSC_SCSI_ReadCapacity called from USBH_MSC_Process fails with reading capacity. It returns USBH_FAIL and then state machine goes to MSC_REQUEST_SENSE mode which is displayed on LCD for FLASH KE which does not work (''Sense Key 6''). Why is this happening?

Googling about Sense key 6 and sub codes, gives me this:

6 28 00 Unit Attention - not-ready to ready transition (format complete)

0690X00000603SbQAI.jpg0690X00000603SlQAI.jpg

tm3341
Associate II
Posted on August 07, 2015 at 08:14

Noone?

Mayla and co.?
mgualdi9
Associate II
Posted on August 26, 2015 at 11:41

Hi, i had the same error.

The problem is in the last revision of the CubeMX library for F4 and think is the same for F7.

At this moment i find a workaround.

I have copied the file ''usbh_msc.c'' from library F4 V1.6.0 to the library F4 V1.7.0, and this is fine.

I think you can copy this file from F4 library in to the F7 library and try.

Regards,

Mauro.