Hi Fredy,
This is not an easy question. Most people believe USB is just like a COM port and that porting a serial application to USB is just a matter of changing the medium. Unfortunatelly it is not so easy.
The first thing to note is that USB is not just a serial line, it is a complete (and complex) protocol. USB is a master-slave assynchronous serial protocol where the master (the host) controls all aspects of the communication.
USB is based on frames and uses a multiplex scheme just like a TDM multiplex. There are special electric levels, packets, pipes, transactions, requests and descriptors used to support the configuration, control and data-flow.
When a USB device is plugged in a hub port, the host is notified of this event and starts a standardized protocol to read the device characteristics and capacities. These information are stored in descriptors. By reading these descriptors the host can decide which driver must be loaded to communicate with the device.
That said, I believe there are some ways to communicate with a USB device:
1- by using an HID firmware. HID devices are human interface devices (such as mouse, keyboard, joystick, etc) which interact with the user and send (or receive) information to the host. The HID class includes some interesting devices such as: displays, leds, keys, switches, etc. Some generic HID drivers are automatically loaded by the OS (such as mouse and keyboard drivers), but to use a HID display, you will need to write your own application. There are some websites describing how to do it:
http://www.lvr.com/hidpage.htm and
http://www.beyondlogic.org/usb/usbdevdrvs.htm are two of them. I have implemented HID devices (a mouse and a volume control) using a STR711 (ARM7) MCU, I would like to try the JM devices as soon as I get a kit. I also played with HID programming in windows (using Delphi and the JEDI library).
2- by using a CDC firmware. The CDC class is used for external USB modens and includes virtual COM ports. By using a virtual COM port, you don't need to modify your host application and this is an easy way to add USB functionallity to an existing device (the FTDI chips work this way). I also implemented CDC firmware, but only on the STR711 MCU.
3 - by using your own device class. This is the hardest way. You will need to write your own host driver ... Good luck!
This is just a beggining, hope it helps.
Best regards,
Message Edited by fabio on
2008-04-09 01:26 PM