2
votes

I've got an Atmel AVR A90USBxxxx device that I have configured to "talk USB" via CDC. It's designed to take input from a Host computer, running Windows, Linux, or OS X.

I'm under the impression that Linux and OS X will immediately recognize this CDC device, and with a simple .inf a Windows machine can be told my VID/PID should be opened as a CDC device using usbser.sys.

My question is once the OS has opened this USB device as a serial device, how can I programmatically read and write to that port (for each of the 3 OS's listed but most detail is needed for Windows as I'm completely unfamiliar there)

Thanks

1
Google should give you enough examples regarding serial port programming for either OS.Turbo J

1 Answers

0
votes

The answer really depends on what programming language you intend to use. Without knowing what language you intend to use, I can't tell you exactly how to do it, but I can point you in the right direction.

For prototyping, I recommend using Python with the PySerial module. It's very easy to set up and quickly write a functional prototype. Python will run on Windows, Linux, and OS X. That way you only need to write the serial communication code once and you can test on all of your platforms.

The PySerial documentation contains some examples for how to read and write to the port.

If Python doesn't work for you in production, I would still recommend sticking with a programming language that has a cross-platform serial port library if possible.

Here's a question that was asked already about a cross-platform serial port library for C: C: cross-platform RS-232 serial library?