2025-12-21 8:33 PM - last edited on 2025-12-22 1:46 AM by Andrew Neil
Requesting ST to kindly provide a working example for STM32U545 using stand-alone USB HOST MSC to interface with a USB Pen drive. A Tech-Note explaining the code to be added to the various CUBEMX generated files would help.
I have been logging to the USB Pen Drive for years using the F105 and F405 series.
For battery operated devices I planned to move to U545 expecting a simple code migration but the USB interface has changed from the familiar and simple FATFS.
I tried to refer to the available USBX/FILEX samples of various other devices but could not get them to work as many refer OTG types while U545 has DRD types.
I referred to various threads on the community.st.com but they trail off without answers.
Thanks.
Solved! Go to Solution.
2025-12-26 7:40 AM
Hello @NFern.1
You can also check this repository which contains the application for the STM32U5:
stm32u5-classic-coremw-apps/Projects/NUCLEO-U575ZI-Q/Applications/USB_Host/MSC_Standalone
It should be helpful for your USB Host MSC implementation, along with the article already provided.
Thank you!
Best regards.
2025-12-23 6:55 AM - edited 2025-12-23 6:55 AM
Hello @NFern.1
You can refer to the application available in the STM32U575I-EV project, which uses the same USB configuration. Just make sure not to include USBPD in your project and ensure that your device (pen drive) is powered via the VBUS line by external power.
The example can be found here:
Best regards,
hamdi
2025-12-24 6:51 AM
Hi,
Thanks for the response. The example suggested for reference uses ThreadX.
My requirement is for Stand-Alone without using ThreadX.
Anyway, I decided to try and replicate the project, ThreadX and all, with U545.
However in CUBEMX, under "USBX Mode and Configuration"->"UX Host FS"->"Host Class FS"->"MSC" is disabled.
Please confirm if USB Host Mass Storage Class is supported with U545.
I am using the NUCLEO-U545RE-Q Board for testing.
2025-12-24 10:03 AM
Hi @NFern.1
I have already answered your question in the other post. You need to enable FileX in threadX context. If you would like to implement it in standalone context you need to enable this
#define UX_HOST_CLASS_STORAGE_NO_FILEX
However, this is not directly using CubeMX code generated. You need to configure it manually.
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-12-25 7:18 PM
Thanks @FBL , on enabling FileX in CubeMX - the Host Class FS -> MSC option is now enabled. I should have done all the settings before posting the query, sorry for that.
I will first try to get a working U545 project with ThreadX, USBX, FileX, then I will try the standalone mode.
2025-12-26 2:13 AM
Hello @NFern.1
For standalone mode, the following article can help you add the USB Device Library to your project and customize it for your application.
How to implement a USB composite device applicatio... - STMicroelectronics Community
Best regards,
Hamdi
2025-12-26 3:33 AM
Hi @T_Hamdi , requesting you to please write a similar article for USB HOST MSC, it will really help us.
The article is really good, but we may miss some steps when attempting to convert to host mode.
Our Sincere Thanks for your support!
2025-12-26 7:40 AM
Hello @NFern.1
You can also check this repository which contains the application for the STM32U5:
stm32u5-classic-coremw-apps/Projects/NUCLEO-U575ZI-Q/Applications/USB_Host/MSC_Standalone
It should be helpful for your USB Host MSC implementation, along with the article already provided.
Thank you!
Best regards.
2025-12-28 11:53 PM
Based on the responses to this post, I understand that the STM32U545 USB Host MSC supports USB pen drive.
There are 3 approaches:
1. With USBX, FILEX, No THREADX (ie. Stand-Alone Mode)
2. With USBX, FILEX, THREADX (ie. RTOS Mode)
3. With ST's Classic Core Middleware STM32_USB_Host_Library and FATFS
However currently no sample code is available specifically for this application with STM32U545
I started with approach 1, then tried 2 and finally tried 3, but I could not succeed for now.
I will work on this again after a few days when I get time.
This post can be closed. I will open a new post for specific queries as and when I encounter them.
2026-01-05 4:00 AM
Approach 3 ST's Classic Core Middleware STM32_USB_Host_Library and FATFS was successful and I have documented the steps in the post below.
Solved: How To access a USB Pen Drive with stm32u545 using... - STMicroelectronics Community