Skip to main content
Associate
May 24, 2025
Solved

Help with USB MSC using USBX + FileX on STM32H573RIT6

  • May 24, 2025
  • 2 replies
  • 849 views

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,

This topic has been closed for replies.
Best answer by FBL

Hi  @VijayKushwah 

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.

2 replies

FBLBest answer
ST Technical Moderator
May 26, 2025

Hi  @VijayKushwah 

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 "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
AScha.3
Super User
May 26, 2025

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 :

AScha3_0-1748278546293.png

usbx:

AScha3_1-1748278648595.png

 

If you feel a post has answered your question, please click on " Best Answer ".