2025-09-10 5:47 PM - last edited on 2025-09-11 6:45 AM by FBL
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:
NVIC:
RCC:
SYS:
USBX:
clock tree:
code:
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:
MX_USB_OTG_HS_PCD_Init:
HAL_PCD_MspInit:
edit
related thread: Solved: STM32U5A9J-DK1 USB Device question - STMicroelectronics Community
Solved! Go to Solution.
2025-09-12 7:30 AM
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.
2025-09-11 6:53 AM
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.
2025-09-11 6:58 AM
HIi @FBL
Thank you for your reminder, and thank you for helping me start a new discussion.
Here is my ioc file.
2025-09-11 4:14 PM
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!
2025-09-12 7:30 AM
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.
2025-09-12 7:24 PM
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?
2025-09-14 11:12 AM
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.