cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H753I-EVAL2 USB FS Host Mass Storage Example with ThreadX, USBX, and FileX

pranavps
Associate II

 

I’m trying to get a USB Full-Speed Host Mass Storage example running on the STM32H753I-EVAL2 using ThreadX, USBX, and FileX.

I’ve generated the base project from CubeMX, but I’m running into a few issues:

VBUS Enable/Detection:

 

  • VBUS is not being enabled correctly via the MFX (IO expander).
  • Even when manually configuring, the stack doesn’t seem to handle VBUS properly in host mode.

Memory Pool & Stack Sizes:

  • Default memory pool size and system/stack sizes seem insufficient, causing failures with Mass Storage class. tried increasing but did not succeed and ended up in memfaults

I’m looking for:

  • A working USB FS Host Mass Storage example for STM32H753I-EVAL2 with ThreadX, USBX, and FileX.
  • Guidance on properly enabling VBUS via MFX or directly on the board.
  • Recommended USBX memory pool and stack sizes for Mass Storage class.
  • BSP package for STM32H753I-EVAL2

Any example projects, tips, or guidance would be greatly appreciated.

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

My Bad.

USB drive was originally formatted with GPT (GUID Partition Table) instead of the classic MBR partition table.

Properly formatting the USB drive solved the issue

View solution in original post

3 REPLIES 3
FBL
ST Employee

Hi @pranavps   & welcome to ST Community,

  1. Would you explain in details what's missing for VBUS management in host mode related to this board?
  2. About default memory pool size, I agree. CubeMX code generated sets default value just as a given example to be adjusted by developer according to the application. But I agree it doesn't take into account the host role and class being used as input to predict reasonable memory size.
  3. As of now, I suggest you taking a look at the following example.
  4. For BSP pack, I assume this board is similar to the following package MB1246 since first version is obsolete.

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.




Best regards,
FBL


Hi

Thank you for the response.

Regarding VBUS management, on the STM32H753I-EVAL2 board the VBUS power switch is controlled through the MFX IO expander and not directly by a GPIO. Initially, VBUS was not getting enabled properly in host mode.

To resolve this, I had to initialize the MFX device through I2C and enable the VBUS power switch using the BSP IO driver. After adding the proper BSP initialization sequence, VBUS started enabling correctly and the USB device could be detected.

Once this was fixed, the USB MSC device enumeration works correctly, and I get the following output:

 

**** USB OTG FS MSC Host ****
USB Host library started.
Starting MSC Application
Connect your MSC Device
STarting msc_process_thread_entry

USB Mass Storage Device Plugged
PID: 0x2003
VID: 0x3f0

*** Start Files operations ***

ERROR: !! Could Not Create TEST.TXT File !!

While debugging further, I found that the failure occurs in FileX when creating the file. The error originates from _fx_file_create() returning FX_MEDIA_NOT_OPEN:

if (media_ptr -> fx_media_id != FX_MEDIA_ID)
{
/* Return the media not opened error. */
return(FX_MEDIA_NOT_OPEN);
}

So it appears that the FileX media is not successfully opened before the file operation, even though the USB device is detected and enumerated.

For memory configuration, I am currently using:


#define USE_STATIC_ALLOCATION 1
#define TX_APP_MEM_POOL_SIZE 1024
#define FX_APP_MEM_POOL_SIZE (1024 * 2)
#define UX_APP_MEM_POOL_SIZE (1024 * 64)
#define UX_HOST_APP_THREAD_STACK_SIZE 1024
#define UX_MSC_APP_THREAD_STACK_SIZE (1024 * 2)

The implementation is adapted from the STM32H735G-DK USBX MSC Host example in the X-CUBE-AZRTOS-H7 repository.

Also attaching the main and ld file

Please let me know if you suspect this could be related to:

FileX media initialization

memory pool size

Thanks again for the guidance.

My Bad.

USB drive was originally formatted with GPT (GUID Partition Table) instead of the classic MBR partition table.

Properly formatting the USB drive solved the issue