How does the LocalFilesystem disconnect/re-connect the mbed MSD interface?

04 Mar 2012

I have implemented a data logger storing data to a uSD card and I'm able to access the card locally using the FATFileSystem class to perform the logging, and also via USB by attaching it as a Mass Storage Device. It is not possible to do both at the same time as both use block level access and two FAT file systems cannot coexist in this manner.

I have got round this by disconnecting the USB device when I need to perform logging and then re-connecting to enable access to the logs.

All very well until I add a USB serial console connection. Unfortunately that connection gets dropped too when I disconnect the MSD.

So, what I'm after is the standard behaviour provided by the mbed "magic" chip whereby the serial connection is maintained whilst the MSD is disconnected and reconnected under the control of the mbed.

Having consulted the USB specs I can see how this would be done from the host end using SetConfiguration, but how the "magic" chip achieves this is a mystery.

Could somebody with knowledge of how this can be achieved please enlighten me.

Thanks,

Steve

04 Mar 2012

not quite sure, but I think there is a connect - disconneoct method,

but cannot remember.

there should be a method.

ceri

04 Mar 2012

There's not much one can do besides stall an endpoint unless using interrupts, which I'm not. I suspect the fix is to tell the host that removable media may have been changed, but if somebody in the know could simply tell me, life would be simpler!

Steve