cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5A9J-DK1 USB Device as mass storage standalone question

tod
Associate II

Hi, @FBL 

I am also using this board and STM32Cube_FW_U5_V1.8.0 to create a USBX stand-alone (without THREADX) MSC device,but struggling to get the board to enumerate with the PC.
I'm not sure if it's a configuration issue or a code modification problem.

Below are my configurations and code modification points.
Could you please help analyze them? Thank you very much!

configurations:

USB_OGT_HS:

tod_0-1757551157942.png

NVIC:

tod_1-1757551166322.png

RCC:

tod_2-1757551171176.png

SYS:

tod_3-1757551200781.png

USBX:

tod_4-1757551208475.pngtod_5-1757551212555.pngtod_6-1757551216152.pngtod_7-1757551233581.png

clock tree:

tod_8-1757551329824.jpeg

tod_9-1757551333381.jpeg

code:

tod_10-1757551379374.png

UINT MX_USBX_Device_Init(VOID)
{
//default code
......

/* USER CODE BEGIN MX_USBX_Device_Init1 */

USBX_APP_Device_Init();

/* USER CODE END MX_USBX_Device_Init1 */

return ret;
}

USBX_APP_Device_Init:

tod_11-1757551395215.png

MX_USB_OTG_HS_PCD_Init:

tod_12-1757551434831.png

HAL_PCD_MspInit:

tod_13-1757551490867.png

 

edit

related thread: Solved: STM32U5A9J-DK1 USB Device question - STMicroelectronics Community

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hello @tod 

Here is working full setup for MSC standalone using USBX. It seems CubeMX is missing RCC clock configuration in HAL_PCD_MspInit() 

    __HAL_RCC_SYSCFG_CLK_ENABLE();

 

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.


View solution in original post

6 REPLIES 6
FBL
ST Employee

Hi @tod 

Sorry for my late response, it would be better to start new discussion for each issue to adhere to ST community guidelines and terms.

Would you attach your ioc file ?

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.


tod
Associate II

HIi @FBL 

Thank you for your reminder, and thank you for helping me start a new discussion.

Here is my ioc file.

tod
Associate II

Hi@FBL 

Is there something wrong with my configuration, or is there an issue with my code changes?

The attached file is my project.

Thanks a lot!

FBL
ST Employee

Hello @tod 

Here is working full setup for MSC standalone using USBX. It seems CubeMX is missing RCC clock configuration in HAL_PCD_MspInit() 

    __HAL_RCC_SYSCFG_CLK_ENABLE();

 

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.


tod
Associate II

Hi @FBL 

Thanks a lot !!!!!

After making modifications based on your suggestions, the enumeration process now works correctly, and an empty drive letter (Removable Disk (H:)) is detected.


I want to use the EMMC as USB storage space, but I encountered another issue: I am trying to access the EMMC via SDMM1, and after implementing the MSC-related functions (read, write, USBD_STORAGE_GetMediaLastLba, USBD_STORAGE_GetMediaBlocklength) in ux_device_msc.c, the formatting operation on the PC side fails. The error message says: "Please insert a disk into the removable disk."
I have already verified that after initializing SDMM1, the EMMC can be accessed and read/write operations are successful. What could be the reason for this issue?
Should I start a new discussion for this problem?

FBL
ST Employee

Hi @tod 

I would suggest starting a new thread to adhere to Community Guidelines and Terms to address further questions or issues.

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.