2024-10-01 12:12 AM
I am on an H573 and trying to rd/wr a file on a fat32-formatted USB memory stick using the mass storage controller.
To jump right into the problem (details further below), I am trying to understand what to do about this block when I am running in standalone mode. This snip comes from the example code which is in RTOS mode. I want standalone mode.
--Background--
As a starting point, I grabbed the Ux_MSC_Host example, and got that working with no difficulties on the H573 dev kit MB1677. That demo uses FileX, UsbX, ThreadX, and some power delivery peripherals.
Then I started some changes:
But...
When I tried to implement something meaningful in UX_DEVICE_INSERTION status, it turns out that the expression
media = &storage_media->ux_host_class_storage_media;
fails to compile because the type "FX_MEDIA" is undefined. I need FX_MEDIA so I can use functions like fx_file_open or fx_file_read.
Apart from the undefined type, the field itself is if-def'ed away within ux_host_class_storage.h:
typedef struct UX_HOST_CLASS_STORAGE_MEDIA_STRUCT
{
#if !defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
UX_MEDIA ux_host_class_storage_media;
ULONG ux_host_class_storage_media_partition_start;
VOID *ux_host_class_storage_media_memory;
ULONG ux_host_class_storage_media_status;
ULONG ux_host_class_storage_media_lun;
ULONG ux_host_class_storage_media_sector_size;
#else
struct UX_HOST_CLASS_STORAGE_STRUCT
*ux_host_class_storage_media_storage;
ULONG ux_host_class_storage_media_number_sectors;
USHORT ux_host_class_storage_media_sector_size;
UCHAR ux_host_class_storage_media_lun;
UCHAR ux_host_class_storage_media_status;
#endif
} UX_HOST_CLASS_STORAGE_MEDIA;
and the #defines are set earlier:
#if defined(UX_HOST_STANDALONE) && !defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
#define UX_HOST_CLASS_STORAGE_NO_FILEX
#endif
I thought maybe I could tweak this vendor file (slightly queasy about that). But that's when I found statements like this littered throughout the library:
I want FileX (and picked it in Cube), so this #define is confusing. I guess the question is: what is the proper configuration of #defines to bring all these pieces together properly? Or is standalone host msc not a supported feature? Are there lib tweaks I can make that will fake it?
I have found these informative - but they vary:
Lastly, I attached the ioc and a pdf with recap/screenshots of what I changed.
2024-10-04 09:44 AM
Hi NotMark
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Kind Regards
Joe
STMicro Support