Skip to main content
Explorer
May 3, 2023
Solved

STM32F4 Another USB Host MSC problem.

  • May 3, 2023
  • 4 replies
  • 3885 views

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?

    This topic has been closed for replies.
    Best answer by RÖztü.1

    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.

    4 replies

    Visitor II
    May 4, 2023

    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​.​

    Graduate II
    June 5, 2023

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

    Visitor II
    June 5, 2023

    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...

    RÖztü.1Author
    Explorer
    May 4, 2023

    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ü.1AuthorAnswer
    Explorer
    May 4, 2023

    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.

    Graduate II
    May 29, 2023

    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​