I am new to the FEZ platform.
We are working on an IMU logger project. We would like to be able to calibrate and get live data from the sensors via the virtual com port. And then use the mass storage USB client service to browse and transfer the log files.
As I understand it is not possible to use both services at the same time as a composite device. So we need to be able to swap between the two services from the application on the PC. Is that possible?
I imagine that in serial mode we can just send a command and the do the switch. But I am not sure how we can give a switch command when it is in mass storage mode. Any ideas? Is it possible to access the SD card from the microcontroller while it is mounted as mass storage device on the PC?
You can switch between both options anytime you like. Using both simultaneously will give you a lot of headache on the PC side, no mater what kind of device you have.
You can’t access the SD card from both sides (internally and over USB) simultaneously . This is impossible due to the buffering that both sides do.
Thanks for your reply.
Is there a way to notify the microcontroller to switch when mass storage mode? We would like to avoid a hardware switch and control everything from the PC software.
I don’t suppose there is any way that I can send commands from the PC to the microcontroller when in mass storage mode. But is it possible to detect that the storage device has been ejected?
Please check the following thread (NetMF Shell video):
You might find it interesting.
Interesting - wonder what usb protocol he is using to communicate with the device.
[quote]Is there a way to notify the microcontroller to switch when mass storage mode? We would like to avoid a hardware switch and control everything from the PC software.
You actually can’t do the switch in hardware, it is done ins software! Switching in your software depends on how you want it done. It is totally up to your application.
On FEZ you can call usbc.Stop() to stop current device and then usbc.Start(different device) to switch between them. See documentation:
Thanks for the link Mike.
I wondering however how I can communicate with the chip from the PC when in the mass storage device mode. From Gus I understood that composite devices was not supported, but in the documentation it says that it is. So can I run two devices at the same time?
Yes, what Gus is correct.
You cannot access a storage from two side at the same time.
It is up to your application on how this can be done. You can try different ones and see how they are done.
There is no way of detecting the PC ejecting a USB storage.
You can have a composite device of mass storage and COM port in USBClient and it is mentioned in the documentation, but, like Gus said, this might give some headache and PC side needed drivers.
Persistent Storage documentation gives an example on how to enable or disable PC access to mass storage by calling methods in NETMF.
Or you can use mass storage or virtual serial port at one time. This is what I mentioned.
Thanks - I have a board coming soon so I can start doing some tests