cancel
Showing results for 
Search instead for 
Did you mean: 

USBX Host MSC Standalone functions missing

Capocc
Visitor

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?

5 REPLIES 5
Mohamed_AYED
Senior

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));

 

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

 

 

Mohamed_AYED
Senior

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();

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.

FBL
ST Employee

 

Hi @Capocc@Mohamed_AYED 

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.