FROM THE BLOG

MSP430 USB Library

You may know there are some MSP430F5 devices that have a USB device peripheral built-in to the MCU.  This is kind of great, because the cost of an MSP430F55xxdevice and glue circuits is not much more than the cost of an FTDI FT232 or SiLabs CP210x bridge chip, so you could save a bunch of board space and money, or you could use the MSP as a dedicated front-end and put on a full-blown TTY driver and minimal shell.  That would be pretty cool.

In contrast to the STM32 USB library, the MSP430 USB library is extremely easy to setup for basic testing.  However, it’s a giant pain to integrate it with a pre-existing system (such as OpenTag).  It’s also bloated as hell (5KB) and somewhat unreliable, although the unreliability is mostly to do with the fact that the MSP430 doesn’t have an NVIC, so other time-critical, interrupt-driven processes can cause some data corruption of the USB buffer (the USB MAC generates quite a few interrupts and is somewhat time-critical, itself).

I’ve spent a long time optimizing the OpenTag MPipe driver to work as reliably as possible with MSP430F5 USB, while not interfering with DASH7 MAC processes.  Occasionally, you might receive some broken data on OTcom, which occurs when RF interrupt handling blocks USB interrupts, but it’s quite fine for building a little USB stick.  I’ve also de-bloated the TI code by quite a bit (now 3.5KB) and made it CDC-specific.  There’s a lot more potential for optimization, though.

The code is available with OpenTag.  GitHub is a good place to look at it.

Leave a comment

Your email address will not be published. Required fields are marked *