Skip to main content
Explorer II
November 18, 2025
Question

USBX Host MSC Standalone functions missing

  • November 18, 2025
  • 4 replies
  • 321 views

I am on an H562 and trying to rd/wr a file on a USB memory stick using the mass storage controller. 

I am trying to understand what to do about this block when I am running in standalone mode. I started from an example code which is in RTOS mode but I want use the standalone mode.

When I tried to implement something meaningful in UX_DEVICE_INSERTION status, it turns out that the expression

_mediaPtr = &_storageMediaPtr->ux_host_class_storage_media;

fails to compile because  'UX_HOST_CLASS_STORAGE_MEDIA' has no member named 'ux_host_class_storage_media'.

Capocc_1-1763462236696.png

I think the problem is in this definiton:

Capocc_2-1763462321952.png

but I need to use FILEX.

 

Than I tried the method 2 using the function 'ux_host_class_storage_media_get' but it is not present in the folder Middlewares/ST/usbx/common/usbx_host_classes/src

Capocc_3-1763462637638.png

Which of the two methods should I use?  How can I skip the problems? Do I have to define something different?

    This topic has been closed for replies.

    4 replies

    Explorer
    November 18, 2025

    Hi @Capocc,

    For USBX host storage class your need to Initialize FileX and open media on app side before starting file system media  operations.

    UCHAR storage_media_buff[10*4096];
    FX_MEDIA storage_media;
    UX_HOST_CLASS_STORAGE_MEDIA *host_storage_media;
    
    fx_media_open(&storage_media, 
     "USB_DISK",
     _ux_host_class_storage_driver_entry,
     host_storage_media, 
     storage_media_buff,
     sizeof(storage_media_buff));

     

    CapoccAuthor
    Explorer II
    November 18, 2025

    I have the same problem with the function '_ux_host_class_storage_driver_entry'

    It is unreachable due to the #define UX_HOST_CLASS_STORAGE_NO_FILEX

    Capocc_0-1763471397217.png

     

     

    Explorer
    November 18, 2025

    you can declare the prototype in usb.h (app side)

    VOID _ux_host_class_storage_driver_entry(UX_MEDIA *media);

    and don't forget to init FileX:

    fx_system_initialize();

    CapoccAuthor
    Explorer II
    November 18, 2025

    Thank you for the support, the fx_system_initialize() is called during the initialization.

    I can declare the protottype in usb.h, but what about the implementation? This function will be called somewhere and I don't have the code. I'm thinking about some #define problem from the .ioc or an incorrect usage of the API provided.

    Explorer
    November 18, 2025

    already declared in ux_host_class_storage_driver_entry.c 

     

    https://github.com/STMicroelectronics/stm32-mw-usbx/blob/db1d27995303d346ee731c79353dfe5f832cada9/common/usbx_host_classes/src/ux_host_class_storage_driver_entry.c#L147

     

    I think that the logic host storage class in standalone mode allow users to use file system in applicative side (filex, fatfs, .... ) in this case you need to customize  ux_host_class_storage_driver

    Technical Moderator
    November 18, 2025

     

    Hi @Capocc@Mohamed_AYED 

    AFAIK, USB MSC standalone for host operations is still not supported because of this dependency with FileX in threadX context.