3
votes

I'm developing software in a microcontroller with a USB controller and code example to implement a Virtual COM port.

The implementation it's a device that transfer data back and forth and I was thinking about using 2 bulk endpoints, using libusb in my computer to read and write in them.

The virtual COM would have the advantage of not needing libusb since the driver it's already there and communication would be done by interfaciing with a com port (in this case is Linux only).

In terms of data transfer, what would be fastest? I understand that both would be implementations using 2 bulk endpoints (virtual com uses an interrupt as well, not sure if I need it now). Is it possible that, even with virtual com port payload, that transfer rate will be the same as implementing something using 2 bulk endpoints, with no USB class?

Any other point you think I'm missing to make this decision?

1
Nothing ever gets faster with an extra emulation layer. The odds that you'd notice the difference are however rather low. The clear advantage of a serial port emulation is that you can use just about any language and any library to talk to the device. The clear disadvantage is that you have to discover the port number and cannot deal well with surprise device removal. Pick your poison. - Hans Passant

1 Answers

1
votes

To implement a virtual COM port you also have to use a USB class USB CDC ACM.

https://en.wikipedia.org/wiki/USB_communications_device_class

See this for UART standard baud rates https://electronics.stackexchange.com/questions/9264/what-standard-uart-rates-are-there

110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 230400, 460800, 921600,... High baud rates sometimes make problems

When using USB CDC ACM the device will be recognized as (virtual) COM port and can be accessed via a termin

bulk transfer is the easiest way to transfer data at maximum speed and can be used with the mass storage device class

https://en.wikipedia.org/wiki/USB_mass_storage_device_class

The device will be recognized as mass storage (normal drive like a USB stick)

See this http://www.beyondlogic.org/usbnutshell/usb4.shtml#Bulk

If you need examples and source code for Atmel MCU see the LUFA library (http://www.fourwalledcubicle.com/LUFA.php) or check out the embedded operating systems like Contiki OS. These include USB source code for other MCUs like MSP430,... also