V-USB as a Serial Port - Is That OK?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
bt101
Posts: 7
Joined: Thu Aug 27, 2009 5:59 am

V-USB as a Serial Port - Is That OK?

Post by bt101 » Thu Aug 27, 2009 6:18 am

Hi - I just got V-USB working and I am impressed. I was able to get the hid-data example working.

As I move forward, can you guys point me in the right direction?
I am really, really used to talking to my controllers using rs-232 or USB to rs-232 converters. I can easily write perl programs to open and communicate over the serial port.
Now that I have V-USB working I was hoping to have the V-USB device show up as a serial port.

I read a comment in the source code that said that it is not desirable to make V-USB appear as a serial port and the comment referred to using AVR-CDC.

Can I ask why it is undesirable to make the V-USB device appear as serial port?
Wouldn't a serial port be the "best" implementation of V-USB as it is such a universally recognized implementation?

If I don't go the serial port route, I'm kinda in the dark right now. If I make the device appear as an HID device (not sure if there are other options) do I lose the ability to make a simple perl program to talk to the device (do I have to write a C program).

If you can point me in the right direction it would likely save me a lot of grief/time.
Thanks

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: V-USB as a Serial Port - Is That OK?

Post by maxi » Thu Aug 27, 2009 9:56 pm

I guess it really depends on what you are ultimately trying to do.

The reason CDC is not officially recommended is because it does not comply to spec for low speed usb. However in most cases it will work perfectly well, though windows vista & some versions of linux will require some special considerations. See the documentation wiki & the AVR-CDC project page for more info.

If its a personal project that you plan to use yourself then the CDC approach will probably be just fine. If you want to make something portable then maybe a custom or HID class would prove less problematic in the long run.

Guest

Re: V-USB as a Serial Port - Is That OK?

Post by Guest » Fri Aug 28, 2009 1:23 am

Thanks for the reply.
I must be misunderstanding something because it seems like the HID approach is less portable.

Let's take an Arduino for example. It has hardware USB that emulates a serial port. Anybody can plug it into there machine and start talking to it right away.
I'm guessing that if I do the same thing (except with V-USB instead of the FTDI chip) I too would have a nice portable device where somebody would plug-it-in and they could immediately talk to it with a perl program etc.
Correct me if I'm wrong but if I make an HID device, don't I have to compile software and send it to somebody before their PC can talk to it?

As an aside, I didn't notice all the limitations of avrcdc (like it doesn't work on newer version of linux). I plugged it into my Ubuntu box and the machine crashed. So my decision may already be made for me. Maybe there's some other way to emulate a serial port. it would just seem to be the most universal solution to talk to anything.

Post Reply