cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube STM32F756 USB Composite device CDC(VCP) + MSC(eMMC Udisk)

ddavi.8
Associate II

Hi ST Communities,

My hardware is MCU STM32F756, USB phy USB3300, eMMC mtfc2gmdea-0m.

USB is used for communication between slave and PC,USB driver is combined device class VCP+MSC, and eMMC is hooked up to FATFS.

Now the problem is that while eMMC is hooking up the file system, it is also enumerated as a USB drive through USB. EMMC can only write small data through f_wite, but it will fail to write big data.

I think it may be because eMMC hooks FATFS at the same time and enumerates the usb flash drive. It is ok to hook file system f_wite to write big data by eMMC alone. It should be confirmed that eMMC FATFS and eMMC Udisk cannot be coupled at the same time.

Now I want to unmount eMMC Udisk before eMMC f_wite writes data, but I don't know how to unmount eMMC Udisk alone in a composite device.

4 REPLIES 4

Yes, you will have data coherency problems if you have two independent systems trying to interact with the files system at the same time. Read Only for both could be managed. There are SCSI commands the USBSTOR/MSC could be using to block access or refresh the media, one system tends to lose the arbitration.

Yes, best to dismount media when MSC connection is established, or hold mutex/semaphore to block FATFS usage within this time frame.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ddavi.8
Associate II

>>There are SCSI commands the USBSTOR/MSC could be using to block access or refresh the media, one system tends to lose the arbitration.​

USB SCSI unload command is specific to use which? Do you have specific examples for reference?

>>There are SCSI commands the USBSTOR/MSC could be using to block access or refresh the media, one system tends to lose the arbitration.​

USB SCSI unload command is specific to use which? Do you have specific examples for reference

Well a mix of load/unload, but more sense reporting that the media is unavailable or has changed.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..