LUFA open source USB stack now for NXP ARM processors

Looks like the Lightweight USB Framework for AVRs (LUFA) has just been ported for ARM microcontrollers. NXP recently released a package for their LPC Cortex M3 family of ARM controllers. You won’t find a reference to LUFA on their nxpUSBlib description page (which we think is kind of sad), but if you grab a copy of the beta code the Version.h header file shows that it is indeed a port of the project. This is further backed up by the LUFA creator, [Dean Camera], who consulted with the NXP team doing the work.

The package provides an open-source USB stack that you can use in your projects as a USB host or USB device. We’re advocates of open source packages like this one as it makes it much easier for hobbyists to get help using the tools, and it allows the community to give back through bug fixes and feature additions.

13 thoughts on “LUFA open source USB stack now for NXP ARM processors”

If you want to use USB for something low-bandwidth, this is a great option since it saves a few precious KB for program memory. The best part is that there are already HID drivers written for Windows, Linux and some phones so you don’t have to write your own custom driver for each device.

The LPC134x parts, like the other micros supported by LUFA, implement the hardware and low-level functions of a complete USB device, which is not restricted to the HID profile. HID is a limited class of USB device intended for low-speed input devices (hence the name.) Lots hobbyists mistakenly think that HID is the way to connect a micro to your Mac/PC/Phone but in general this is not true.

Other microcontrollers support being both a USB device or their own USB host (so other USB devices can connect to them.) USB On-The-Go (where it can auto-negotiate a host or device role) is another available implementation.

Note that you don’t need to “develop drivers for a bunch of operating systems” either way, since that’s what libusb is for. A simple libusb_open_device_with_vid_pid(), libusb_claim_interface() and voila, you can do libusb_bulk_transfer() to your heart’s content. I’d almost say that this might even be easier than doing whatever you need to do to (ab)use the HID protocol on your target platform. Unless, of course, you actually want to deliver keystrokes, mouse movements, or similar things that are directly supported by the OS already.

LUFA is an amazingly clean and easy to use library that out-strips any of the closed source/semi-free (as in not free speech) libraries I have used. The more targets it’s ported to the merrier in my opinion. Also Dean provides personal support to developers which is second-to-none. Nice to see it moving to other platforms!

It takes care of the basic, common functionality of a USB device and allows you to focus on implementing the part that is unique to your product. USB devices operate by sending or receiving chunks of data to/from the host, providing ‘methods’ to be invoked on the device (not unlike a software library or web API) and, in some cases, signalling the host when events happen. This is the stuff you implement that makes your device what it is.

If it’s the same stack that NXP presented at ARM TechCon earlier this month, it’s a library that lets you use the NXP ARM chips that have USB hardware as various USB devices, with little more than “I want to be a Mass Storage device, here are the functions that source and sink data.” Looked cool; almost too easy. Apparently this will be in ROM on the newer USB-capable chips.

Someone has a strange definition of “opensource”, it’s for NXP processors ONLY.
The license reads:
“Permission to use, copy, modify, and distribute this software and its documentation for any purpose is hereby granted without fee, provided that it is used in conjunction with NXP Semiconductors microcontrollers.”

It’s not a “common mistake” to say that open source implies free licensing. It’s actually a widely accepted meaning, and the meaning intended by the people who originally coined the phrase, even though it’s not what the words literally say.