cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Another USB Host MSC problem.

RÖztü.1
Associate II

Hello, by using a STM32F429I-DISC1 I'm trying to read/write to a thumb drive.

When I open and load the provided example in fw packet, it works without problem but that example is an old one and not a CubeMX example so it makes things rough for me.

I tried to test STM32 USB Training 11.2 but it didn't work, I tried other examples I found over net but still no luck. As @GNico.2​ mentioned in his this topic code never reaches to APPLICATION_READY state.

A solution is proposed as upgrading USB Host V3.5.0 middleware from github, Is that also applicable for F4 series?

1 ACCEPTED SOLUTION

Accepted Solutions
RÖztü.1
Associate II

Ok I found the problem, blame is going to both me and ST,

When I was checking the datasheet of F429I-DISC1, USB connector pins are named as OTG_FS_DP, OTG_FS_DN, VBUS_FS. So I was enabling USB_OTG_FS from communication but after a more detailed and late inspection I saw that old example usb config lines are enabling portB pins while my code is enabling portA pins, further looking into it, I realized that USB_OTG_FS is bound to PortA and USB_OTG_HS is bound to PortB. Choosing USB_OTG_HS from communication tab solved all the problem and it is working fine.

It is my responsibility to check pin connections on shematics more detailed I agree that but there is blame on ST too for publishing a misleading schematics. If USB connector pins are connected to USB_OTG_HS pins then name them as OTG_HS_DP, OTG_HS_DN, VBUS_HS please.

View solution in original post

11 REPLIES 11
GLASS
Senior

Hi, we hit that bug on F7 with Hal based on middleware USB HOST v3.4.1. Applying v3.5.0 + CVE patch (now V3.5 1) unlock this.

I bet it's the same for F4.​

Give a try​.​

RÖztü.1
Associate II

I downloaded "Middleware USB Host MCU Component" V3.5.1 and copied it over core and class folders in the "STM32Cube_FW_F4_V1.27.1" repository.

I created a new project, selected PIN_C4 as digital output (for vbus from schematics) 168MHz external crystal HSE settings, activated usart3 for debug, usb fs as host only, activated msc from usb host, activated long file names and exfat, 4096 for max sector size.

Then copied codes from "STM32 USB Training 11.2" (not so much code there, only a function to write to flash) added serial print codes for following the flow.

It still not working, seems like initialization is going smooth, then I put some prints in to MX_USB_HOST_Process();->USBH_Process(&hUsbHostFS); and I see that it always return with case:HOST_IDLE

Still FatFs_USBDisk example working properly so there isn't any problem with thumb drive or connection.

I'm stuck here for days, need a light here .

RÖztü.1
Associate II

Ok I found the problem, blame is going to both me and ST,

When I was checking the datasheet of F429I-DISC1, USB connector pins are named as OTG_FS_DP, OTG_FS_DN, VBUS_FS. So I was enabling USB_OTG_FS from communication but after a more detailed and late inspection I saw that old example usb config lines are enabling portB pins while my code is enabling portA pins, further looking into it, I realized that USB_OTG_FS is bound to PortA and USB_OTG_HS is bound to PortB. Choosing USB_OTG_HS from communication tab solved all the problem and it is working fine.

It is my responsibility to check pin connections on shematics more detailed I agree that but there is blame on ST too for publishing a misleading schematics. If USB connector pins are connected to USB_OTG_HS pins then name them as OTG_HS_DP, OTG_HS_DN, VBUS_HS please.

SGasp.1
Senior

Hi @Recep Öztürk​ .. I am facing same issue.. Can you please share your ioc configuration.. which we have to select HS or FS ? Which are the correct ports ? What about VBUS ? Thanks a lot for your help @GLASS​ 

Hi @GLASS​ .. can you please where to check which version of middleware i have and how to change it ? Thanks

I find the "latest" middleware here :

https://github.com/STMicroelectronics/stm32_mw_usb_host

I don't find a src file with MW version...

but you can give a look @ Release_Notes.html in project directory :

Middlewares\ST\STM32_USB_Host_Library

you can compare files with github,

generally the files from STM CUBE STM32xx ... obtained by STM32 CUBE MX or IDE are outdated vs github...

Thanks a lot @GLASS​ .. I really cannot find which version is using currenlty cube mx.. I hope to replace the folders in the middleware and fix this problem

Eventually can you please help me to check if my ioc file it seems correct for the stm32f429disco1.. just as confirmation.. thanks

@GLASS​  replacing the 2 folders with the ones in the repo creates a lot of issues and errors while compiling.. it seems not to easy for f429

Have you only replaced existing files?

Don't copy all files of github repo.

If you are using MSC you must have only Class/MSC directory, not Template, audio, etc...

All files of Core directory must be updated also.