2025-05-23 9:35 PM - last edited on 2025-05-26 6:08 AM by FBL
Subject: Help with USB MSC using USBX + FileX on STM32H573RIT6 (UX_ERROR during host_stack_initialize)
Hello ST Community,
I'm currently working on a project using the STM32H573RIT6, and I’m relatively new to this STM32H5 series. I’m trying to implement a USB MSC (Mass Storage Class) host using USBX with FileX, and I’m using STM32CubeMX for configuration and STM32CubeIDE for development.
Importantly, I’m working without any RTOS – this is a bare-metal (standalone) implementation, so I'm not using ThreadX or any other RTOS.
However, I'm encountering an issue during the USBX host stack initialization. Specifically, the function ux_host_stack_initialize() returns UX_ERROR, and based on debugging, it appears to be related to insufficient memory allocation.
Here’s what I’ve done so far:
Using default USBX and FileX settings in STM32CubeMX.
Enabled USB in Host mode and selected the necessary middleware components.
No RTOS selected in the project.
No changes to heap/memory sizes so far.
I’ve attached a few screenshots of my CubeMX configuration and relevant code snippets for reference.
Has anyone experienced this issue on the STM32H573 when using USBX & FileX without an RTOS?
Do I need to manually increase the heap or configure memory pools differently?
Any recommended memory allocation settings changes for USBX/FileX in standalone mode?
Are there specific considerations for USB MSC with USBX on STM32H5 without ThreadX?
Any advice, example projects, or tips would be greatly appreciated!
Thank you in advance for your help.
Best regards,
2025-05-26 7:13 AM
Using USBX and FileX without ThreadX is really challenging. The following define is mandatory in case using USBX standalone : #define UX_HOST_CLASS_STORAGE_NO_FILEX So, it prevents FileX integration with USBX in this case. Check similar thread.
#define UX_HOST_CLASS_STORAGE_NO_FILEX
If you need to use USBX and FileX together, it is highly recommended to use them with ThreadX to ensure full functionality and support.
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.
2025-05-26 10:00 AM
Hi,
> Do I need to manually increase the heap or configure memory pools differently?
yes, i think so. I just tried on H563ZI running USBX & FileX with Azure...but same: does not work "out of the box" .
And it needs a lot of memory...rtos or not, makes no difference, i think.
So make the memory pools big....until its working, then still can try to reduce, to find out, whats needed.
I give you my settings, so try :
usbx: