2025-11-27 12:13 AM
Hello!
i'm developing a firmware that use an SD card connected to USBX MSC, and i have a couple of question
i want to understand better the ULONG *media_status value returned in the function :
UINT USBD_STORAGE_Status(VOID *storage_instance, ULONG lun,
ULONG media_id,ULONG *media_status)
UINT USBD_STORAGE_Flush(VOID *storage_instance, ULONG lun, ULONG number_blocks,
ULONG lba, ULONG *media_status)
UINT USBD_STORAGE_Write(VOID *storage_instance, ULONG lun, UCHAR *data_pointer,
ULONG number_blocks, ULONG lba, ULONG *media_status)
UINT USBD_STORAGE_Read(VOID *storage_instance, ULONG lun, UCHAR *data_pointer,
ULONG number_blocks, ULONG lba, ULONG *media_status) i'm hoping that value is related to the SCSI code value that windows need from a USB MSC
is it true? beyond UX_SUCCESS which value can i use? for example to indicate the media as changed or is readonly?
how can the functions ULONG USBD_STORAGE_GetMediaLastLba(VOID) and ULONG USBD_STORAGE_GetMediaBlocklength(VOID) can be fired againafter initialization? (maybe i have changed the SD card)
whats the meaning of this function?
UINT USBD_STORAGE_Notification(VOID *storage_instance, ULONG lun, ULONG media_id,
ULONG notification_class, UCHAR **media_notification,
ULONG *media_notification_length)
thank you!
best reguards
2026-01-19 10:52 PM - edited 2026-01-20 6:33 AM
Hi @ABasi.2
Thanks a lot for your patience and for raising these detailed points.
Following up on ticket 223015, I checked internally with our USBX team. Unfortunately, at this stage, there is no plan to provide an MSC example implementing multi‑LUN.
I found something interesting that may help you.
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.
2026-01-21 12:25 AM
Hello FBL
thank you for the link
BUT
my question is quite different
i don't need a multi lun example
if you read our previos conversation you can check that:
i need to make a project in which i connect my board to a computer like a MSC, then i can add,remove,modify file via USB (i can do that) and i can use that files readed from the microcontroller
also i want to modify that files from microcontroller file and read from PC
i understand that is not possible to use the memory simultanuosely, but for sure there is a method in which i "firmware disconnect" the memory from USB , use it end then reconnect to USB
also there is usually code to send to PC to make the PC to re-read the content of the memory and show on PC
if my question isn't clear please let me know
best reguards