Al Williams

Dr. Dobb's Bloggers

YouSB

January 23, 2012

I think I am almost ready to totally give up on the serial port.

I think I am almost ready to totally give up on the serial port. I know, I know, I'm in danger of turning into an old curmudgeon that clings to history. But I'm trying. It probably doesn't help that my first real job was with a company that made "multiport" adapters — 8 bit processors with 1488 and 1489 RS-232 circuits that could switch one serial port to another. I spent a lot of time working with serial ports.

There are tons of CPUs out there now that can easily do USB. The LPC11U14, for example, does a nice job. You can pick up an LPCXpresso board that has a debugger and the chip for about US$40. Its IDE (based on Eclipse) even runs nicely under Linux. I haven't used it for a USB project yet, but the ARM Cortex-M0 core is familiar and easy to work with.

The last few weeks I've been talking about Microchip, and it also has a number of USB-capable parts. I've done some PIC18F2550 development for USB (watch for it in an upcoming blog) and it is very simple to set up, as long as you don't mind using Microchip's (free) USB stack. The hardware can be as simple as the PIC chip, a USB connector, a few capacitors, and a crystal.

Regardless of the solution you select, it is easiest to use the built-in HID drivers that should come with your operating system. That way you don't need to write real drivers, you just write normal application code and you can read and write data with your USB device.

The only real drawback is that if you want to do anything serious you are going to need a USB vendor ID. That will set you back about US$1000. A bit rich unless you are really building something that is going to be produced in a reasonable quantity. Many vendors, however, will sublicense you to use their vendor ID, as long as you are using their chips. You still have to register so they can assign you a unique identifier (a PID). Be sure to read the fine print, however. For example, Microchip's program allows you to produce up to 10,000 devices. If you exceed that, they expect you to get your own vendor ID. As you might expect, the vendors will insist you only use their ID with their CPUs. Can't blame them for that.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!