2019-12-10 01:38 AM
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.
2019-12-10 07:03 AM
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.
2019-12-10 04:26 PM
>>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?
2019-12-10 04:31 PM
>>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
2019-12-10 04:54 PM
Well a mix of load/unload, but more sense reporting that the media is unavailable or has changed.