AnsweredAssumed Answered

How can I temporalily detach/reattach the MSC only portion of a Composite USB MSC + HID Device from the device itself?

Question asked by David Harrison on Aug 17, 2017
Latest reply on Sep 21, 2017 by Clive One

I have a USB Composite MSC + HID device running on an STM32F746NG (DISCO board) and using an SD card as the local storage. The device also has a local FAT file system accessing the same SD card. I want to be able to do file acesses using the local FATFS (Elm-Chan), but to do so I need to temporalily detach or disconnect the MSC only portion of the composite device while still leaving the HID part intact since that is the control channel from a PC application.


I have tried various means of disabling and re-enabling the MSC part when I do local disk I/O from the FATFs, but without fail, the USB MSC part then gets screwed up when I go to reaccess the same SD card from the PC side MSC. Windows tells me either the device is not there or that files are corrupted.


It is clear that while Windows thinks the USB MSC device is still attached, anything I do using the local FATFS, will mess up the USB MSC part so I need to somehow remove it (from within the device itself) and then reconnect it after I have finished with the local file access. I can't just turn off the USB I/F altogethrr because I still need the HID part of the composite device to continue running.


Can anyone suggest how I can do that?