Author Topic: USB HID Device versus Virtual Com Port  (Read 10562 times)

hessa59

  • Member
  • ***
  • Posts: 2
USB HID Device versus Virtual Com Port
« on: March 06, 2016, 09:47:21 am »
I want to create a micro-controller based monitoring device. That will monitor and display analog and digital data on the screen using C#.

I believe that doing the programming will be significantly more complex using actual usb versus a virrtual com port.

Is there a large improvement in speed when using USB?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB HID Device versus Virtual Com Port
« Reply #1 on: March 06, 2016, 11:10:52 am »
The easiest way to do USB communications is to connect an FT232H or similar chip to an asynchronous serial port on the device. At the host, you can use the .NET SerialPort class or other serial-port APIs to access the device. The device firmware communicates with the serial port. You don't need to know anything about USB to use this method.

For any other device class or vendor driver, including HID, mass-storage, USB CDC, WinUSB, libusb, etc., device firmware must manage enumeration and USB communications at the transaction level. Many vendors provide example code that does much of the work, but you still need some understanding of the code to adapt it for your application. On the host PC, you need a driver that is compatible with the class or vendor driver.

Transfer speed depends on the device's bus speed, the transfer type, the efficiency of the device firmware and host driver and application software, and in some cases, how busy the bus is.

 


hessa59

  • Member
  • ***
  • Posts: 2
Re: USB HID Device versus Virtual Com Port
« Reply #2 on: March 07, 2016, 10:24:32 am »
Thanks for your detailed reply.

There seems to be a lot of factors that will influence the speed of transfer.

It seems like if I go the FTDI route the determining factor in the transfer speed will be my microcontroller and the activity on the PCs USB rather than the FTDI.

I will try some experiments with the FTDI method to see if I have any left over processing capacity for implementing the USB on the device.


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB HID Device versus Virtual Com Port
« Reply #3 on: March 07, 2016, 04:18:00 pm »
Yes, the microcontroller and also your application software. For example, the ReadExisting method will return as much data as is available.

The FTDI chips require extra hardware but you can't beat them for simplicity of coding.