Thursday, July 8, 2010

wootstick v2.0: I learn a 32-bit processor, finally.

Way back in 2007, I designed arguably the most useful piece of electronic hardware of my short and fake EE career, the wootstick v1.1:

Can you spot my reflection?

It's a 3.0"x1.1" board with all the things I thought I might find useful for developing embedded hardware. Namely, a microprocessor with USB and wireless connectivity. The processor is the Texas Instruments MSP430F2274. It's 16-bit, which puts it squarely between the 8-bit ATmega chips made popular by Arduino and 32-bit ARM processors that are now very commonplace in consumer electronics. "USB" really means UART serial through an FTDI chip, so it shows up as a COM port on my computer. And "wireless" means it can interface to an XBee radio.

The name wootstick came from the Wireless bOOTloader, a hardware and software combo that allows the microprocessor to be programed through the XBee radio in addition to the USB serial connection. Very few embedded development kits can match this feat, and none that I know of use a single board design that can switch between being the programmer and the remote target. Thanks to master programmer Cam, the wootloader for v1.1 has been ported to a cross-platform version as well, though we never did get around to distributing it...

In fact, my only real regret about the wootstick v1.1 was that we never did get it "out there." Not really to make money off of it, just because it is an interesting development platform and we could have used some extra third-party support. However, I've personally used it for just about everything, so in terms of return on my time investment, it's been more than worth it. It's one of the few things I've ever made that works well enough for me to rely on it as a unit in larger systems.

But, a few months ago, I finally reached its limit. Remember?

CPU Usage: 99.999999%

I spent almost a month trying to implement field-oriented control on two brushless motor simultaneously.With no hardware multiplier, it was kind of like doing long division in your head. If your head could only store ones and zeros and could only add them to each other or shift them around. As it turns out, my theory that you can make software do anything was not disproved and I did get it to work, as described in this double-post. But the entire experience left kind-of a bad taste in my mouth and I realized that it was time to upgrade my dev kit. But spring semester kept me busy enough that I postponed any such upgrade.

Well, it's summer. No excuses now.

wootstick v2.0

My goal is pretty simple: Keep all of the functionality of the wootstick 1.1, but use a 32-bit processor. And the processor I've chosen for the job, based on a couple of strong recommendations and my own research, is the STM32F103. It's based on the ARM Cortex-M3, and has the following kick-ass features that suit my purposes very well:
  • 32-bit, single cycle multiply and hardware division
  • 16MHz external oscillator w/ PLL = faster than I ever need
  • Six timers. That includes three 16-bit ones with four PWMs each. One even does full synchronous three-phase output with dead time. That's just cheating.
  • Dual, simultaneous analog-to-digital conversion. I'm thinking true synchronous current measurement.
  • Factory-programmed bootloader activated through the UART.
The form factor and peripherals on the board are identical to the v1.1...XBee headers and an FTDI serial/USB converter, plus a small 3.3V regulator arranged on a stick-like board that can fit in a breadboard with one row to spare on each side. Hopefully it just works, but for some reason my vX.0 hardwares seem to have issues. So maybe it will actually be v2.1 that I wind up using for the next three years. We'll see.

As for the first test project, it's an idea I had a long time ago that actually utilizes the numerous and powerful timers: An 8-bit music engine running on top of a 3-phase motor controller. Imagine the musical scanner, but with three tracks. If you're unfamiliar with 8-bit music, here are a few gems:

Spintronics - No way to leave (featured in the awesome GLiP project demo)

Anything with three tracks will work. The basic premise is that each phase PWM will have its frequency controlled by the music engine. The duty cycle will still be handled by the field-oriented control logic so that, in theory at least, it will still be a fully-functional motor controller. Of what possible use is this? Well, besides having ring tones for your EV and alerting pedestrians of your presence...not much. It's just a really good performance benchmarking test for this chip. 

But first I need to learn how to use it... Schematic and board files to come if it works.

1 comment:

  1. Well, a lot of work again.

    See those links: