Skip to main content
Associate II
September 13, 2025
Solved

STM32U5A9J-DK1 USB Device as mass storage standalone via sdmm1 emmc

  • September 13, 2025
  • 5 replies
  • 773 views

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?

The attached file is my project.

tod_0-1757730569995.png

ux_device_msc.c:

tod_2-1757730678625.png

tod_4-1757730856986.png

 

tod_3-1757730698364.png

 

 

 

Best answer by FBL

Hi @tod 

Honestly it took me sometime to realize to never use status = UX_SUCCESS; and use  status = UX_STATE_NEXT; instead !

Now, here is a working example for eMMC ! 

FBL_1-1758287868323.png

FBL_4-1758292949434.pngFBL_5-1758292963529.png

 

5 replies

todAuthor
Associate II
September 13, 2025

Hi @FBL 

Please help me analyze.

Thank you very much!

todAuthor
Associate II
September 14, 2025

Hi @FBL 

I can see an unallocated Disk 3 in Disk Management(3.64GB), but when trying to format it(FAT,size=512), I get the error: "The request could not be performed because of an I/O device error."

tod_0-1757834287000.png

tod_1-1757834357167.png

tod_2-1757834398785.png

 

 

Technical Moderator
September 14, 2025

Hi @tod 

I will try to replicate the issue on my end. But, first, let me suggest you check this thread. It could be helpful.

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
todAuthor
Associate II
September 15, 2025

Hi @FBL 

You can use the project I provided (attachment: MSC_FIN.7z) to reproduce the issue.

I will check and try according to your suggestions and provide feedback.

Thank you very much!

todAuthor
Associate II
September 16, 2025

Hi @FBL 

Did you reproduce the issue? Is it a problem with my configuration or a bug in the code?

FBLBest answer
Technical Moderator
September 19, 2025

Hi @tod 

Honestly it took me sometime to realize to never use status = UX_SUCCESS; and use  status = UX_STATE_NEXT; instead !

Now, here is a working example for eMMC ! 

FBL_1-1758287868323.png

FBL_4-1758292949434.pngFBL_5-1758292963529.png

 

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
todAuthor
Associate II
September 24, 2025

Hi @FBL 

Thank you so much for your help! With your assistance, I have successfully formatted it as well.
However, I noticed that the file read/write transfer speed is very slow (1-2 MB/s). Is it possible to improve the read/write speed by adding ThreadX or using DMA?