Skip to main content
Graduate
June 19, 2025
Question

STM32F767 – USB Host FatFS works on FS but not on HS (internal FS PHY)

  • June 19, 2025
  • 2 replies
  • 1194 views

Hi,

I'm using an STM32F767 with both USB OTG FS and HS in Host mode.

  • FS is working fine with USB MSC + FatFS, and I can create files on a USB stick.

  • HS is set to use internal FS PHY (no external ULPI). It detects the pendrive (HOST_USER_CLASS_ACTIVE), but FatFS fails to create/open any file (f_mount or f_open returns FR_DISK_ERR).

This happens in both bare-metal and FreeRTOS.
If I disable FS, HS works fine. But when both are active, only FS works for file ops.

 

Is there any way to get FS and HS USB MSC + FatFS working together when HS uses internal FS PHY?

Any example or suggestion to fix this dual-port issue would be invaluable.

Thanks!

    This topic has been closed for replies.

    2 replies

    Super User
    June 19, 2025
    Technical Moderator
    June 19, 2025

    Hello @MADHU2 

    When HS uses the internal FS PHY, it shares the same PHY hardware as the FS controller. This means both cannot operate fully independently at the same time because the PHY is a shared resource.

    Since the PHY is shared, only one host controller can use the internal FS PHY at a time.

    Unfortunately, examples with both FS and HS active simultaneously using internal FS PHY are non-existent.

    You can try to merge FS and HS examples carefully, but expect to handle PHY sharing issues manually.

    THX

    Ghofrane

    Technical Moderator
    June 19, 2025

    Hi All,

    @MADHU2  is using two independent controllers @Ghofrane GSOURI  

    Here is an example using F7 as CDC device on HS instance and HID device on FS instance. If still facing issues with your implementations. You may drop the firmware to help you further. 

    MADHU2Author
    Graduate
    June 20, 2025

     

    Hi,

    I'm using an STM32F767 with both USB OTG FS and OTG HS configured in Host mode.

    Hardware setup:

    • FS port uses USB_OTG_FS_DM / DP

    • HS port uses USB_OTG_HS_DM / DP

    • HS is configured to use internal FS PHY (no external ULPI PHY)

    • VBUS is connected to +5V externally, and VBUS sensing is disabled in CubeMX.


    What works:

    • On the FS port, everything works fine. I can mount the pendrive, create .txt/.csv files, and write 50 RTC timestamp logs to the file using FatFS. This works in both bare-metal and FreeRTOS.


    What fails:

    • On the HS port (internal FS PHY), the pendrive is detected, and HOST_USER_CLASS_ACTIVE is triggered.

    • But FatFS fails to create or open the file (f_open() returns FR_DISK_ERR or fails silently).

    • If I disable FS and use only HS, then HS works correctly.

    • If I enable both, only FS works for file operations.


    What I’ve already tried:

    • Used heap_3.c and heap_5.c

    • Increased FreeRTOS heap to 65535 and task stack to 2048

    • USB Host task runs and calls MX_USB_HOST_Process()

    • USB logging function calls f_mount(), f_open(), f_write(), f_close()

    • Works on FS, fails on HS to create the file and open.


    My Question:
    Is there a known limitation when using both FS and HS USB Host ports with MSC + FatFS, especially when HS is running in internal FS PHY mode?

    Has anyone successfully used FS and HS (internal FS PHY) at the same time for independent FatFS logging?

    Thank you!