I am wondering if it possible to create a USB device (in following the device
) composed from
- a custom circuit (eg
arduino
) and - a flash storage
in such a manner that the device
is recognized as a standard usb flash storage
(and as such is operable with standart OS drivers), while said storage holds the utilities to operate with the custom circuit (dispalying the data colled by the circuit); and if so, how?
My first thought was to smack a cheap usb-hub and usb-pen before my circuit but that solution, is not pleasing to me.
My goal is to eliminate the need to carry an extra flash-drive just for the operating software, and use default os drivers, make it plug-and-just-work:
- i plug the device in
- the os (windows) mounts a new flash-drive without needing a special driver
- is start (manually or via autorun) my custom.exe from that flash-drive
- i recive data measured by the circuit
Answer
Your first step is to find a USB microcontroller that has all the peripherals you need to accomplish your task.
The second step is to correctly set up your USB descriptors. The descriptors will tell the PC that your device is a composite device. I have not seen very much support for multiple configurations. So you will need one configuration descriptor.
Typically, composite devices are described by using multiple interface descriptors. So your one config descriptor will say it has 2 interface descriptors. The first interface descriptor will be for your Mass Storage Device. The second interface descriptor will be your custom interface.
EDIT: here's a couple links that might help you out with the descriptors. The USB Generic Parent Driver is what Windows uses to enumerate composite devices. Lots of good stuff here. http://msdn.microsoft.com/en-us/library/windows/hardware/ff539234%28v=vs.85%29.aspx
Here's a link to an Atmel app note which shows an example of a composite device. http://www.atmel.com/images/doc7805.pdf
Microchip has a free USB stack for their microcontrollers. It also contains examples for composite devices. Unfortunately, the link to the Microchip examples is the type that will likely change over the course of time, so your best bet is to google "Microchip Application Libraries"
With that said, you probably don't need a custom interface. If you're just passing around bytes, you can use standard HID drivers to transport your data to and from the device, no custom drivers necessary. However, host-side software will be required to use the OS-specified interface for reading/writing HID reports (in the case of Windows, this is usually ReadFile and WriteFile from the Windows API)
No comments:
Post a Comment