cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U545: stand-alone USB HOST MSC to interface USB Pen drive

NFern.1
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
T_Hamdi
ST Employee

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.

 

 

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.
Hamdi Teyeb

View solution in original post

9 REPLIES 9
T_Hamdi
ST Employee

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:

STM32CubeU5/Projects/STM32U575I-EV/Applications/USBX/Ux_Host_MSC at main · STMicroelectronics/STM32CubeU5 · GitHub

Best regards,

hamdi 

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.
Hamdi Teyeb

Hi,

Thanks for the response. The example suggested for reference uses ThreadX.

STM32CubeU5/Projects/STM32U575I-EV/Applications/USBX/Ux_Host_MSC at main · STMicroelectronics/STM32CubeU5 · GitHub

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.

u545usbx_msc_notsupported.png


Please confirm if USB Host Mass Storage Class is supported with U545.
I am using the NUCLEO-U545RE-Q Board for testing.

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.




Best regards,
FBL
NFern.1
Associate III

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.

T_Hamdi
ST Employee

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

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.
Hamdi Teyeb

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!

T_Hamdi
ST Employee

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.

 

 

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.
Hamdi Teyeb
NFern.1
Associate III

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.

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

Many thanks to @FBL and @T_Hamdi